且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JSON.stringify 的反转?

更新时间:2023-02-15 18:21:28

您需要 JSON.parse() 字符串.

You need to JSON.parse() the string.

var str = '{"hello":"world"}';
try {
  var obj = JSON.parse(str); // this is how you parse a string into JSON 
  document.body.innerHTML += obj.hello;
} catch (ex) {
  console.error(ex);
}