标签:java 一个 javascrip 表示 asc john 文本 name pre
例如
一个对象: { "firstName":"John" , "lastName":"Doe" }
多个对象:
{
"employees": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }]
}
格式:对象名[索引].名称
例如 查询上面employees的第一条数据的lastName
employees[0].lastName
employees[0].lastName = ‘值‘
var txt = ‘{ "employees" : [‘ +
‘{ "firstName":"Bill" , "lastName":"Gates" },‘ +
‘{ "firstName":"George" , "lastName":"Bush" },‘ +
‘{ "firstName":"Thomas" , "lastName":"Carter" } ]}‘;
obj = eval(‘(‘+ txt + ‘)‘);
标签:java 一个 javascrip 表示 asc john 文本 name pre
原文地址:https://www.cnblogs.com/LZYCoding/p/10119107.html