var student = {
id: 'st01',
name: 'Name 1',
age: 20
};
sessionStorage.setItem('student', JSON.stringify(student));
var studentInfo = JSON.parse(sessionStorage.getItem('student'));
console.log('Student Info');
console.log('id: ' + studentInfo.id);
console.log('name: ' + studentInfo.name);
console.log('age: ' + studentInfo.age);
Output
Student Info
id: st01
name: Name 1
age: 20