📜  javascript代码示例中的json

📅  最后修改于: 2022-03-11 15:01:34.137000             🧑  作者: Mango

代码示例6
var str = '{"names":[' +                    // crate JSON object
'{"first":"Hakuna","lastN":"Matata" },' +
'{"first":"Jane","lastN":"Doe" },' +
'{"first":"Air","last":"Jordan" }]}';
obj = JSON.parse(str);                      // parse
document.write(obj.names[1].first);         // access