javascript JSON.parse and JSON.stringify
var jstu = '{"name": "xiaoqiang", "age": 18}'; console.log(jstu); var obj = JSON.parse(jstu); console.log(obj.name); console.log(obj.age); console.log(typeof obj); var obj2 = {"name": "xiaoqiang", "age": 12}; var obj2_string = JSON.stringify(obj2); console.log(typeof obj2_string);
output:
{"name": "xiaoqiang", "age": 18} xiaoqiang 18 object string