JSON.parse() & JSON.stringify()

Please indicate the source of the original reprint: http://agilestyle.iteye.com/blog/2352232

 

JSON.parse()

Demo 

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

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

Console Output


 

JSON.stringify()

Demo 

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

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

Console Output


 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327009754&siteId=291194637