JSON对象提前不知道其属性和结构,遍历其值
var json2 = { "name": "txt1", "name2": "txt2" };
for (var js2 in json2) {
alert(js2 + "=" + json2[js2]);
}
//结果
1:name=txt1
2:name2=txt2
JSON对象提前不知道其属性和结构,遍历其值
var json2 = { "name": "txt1", "name2": "txt2" };
for (var js2 in json2) {
alert(js2 + "=" + json2[js2]);
}
//结果
1:name=txt1
2:name2=txt2