var student = {
id: 'st01',
name: 'Name 1',
age: 20
};
localStorage.setItem('student', JSON.stringify(student));
var studentInfo = JSON.parse(localStorage.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