function person(id,name,age){ this.id=id; this.name=name; this.age=age; } var p=new person(1001,'tom',27); //转换为JSON格式 [{"id":1001,"name":"tom","age":27},{}...{}] var jsonStr=JSON.stringify(p); //将JSON格式解析为字符串 var strJson=JSON.parse(jsonStr); //存储到localStoreage中 localStorage.person=jsonStr; //从localStorage 中读取对象数据 var ls=localStorage.person;