原创转载请注明出处:http://agilestyle.iteye.com/blog/2352232

 

JSON.parse()

JSON.parse() & JSON.stringify()Demo 

var str = '{"username":"nodejs", "password":"23"}';

console.log(JSON.parse(str));

Console Output

JSON.parse() & JSON.stringify()
 

JSON.stringify()

JSON.parse() & JSON.stringify()Demo 

var str = {a: 1, b: 2, c: "test"};

console.log(JSON.stringify(str));

Console Output

JSON.parse() & JSON.stringify()
 

 

相关文章: