如何从json获取值ObjectName?

时间:2014-04-10 14:30:35

标签: json titanium titanium-mobile

我试图从json文件belllow中获取值'ObjectName'。

我试过这样做: 如果我想对象[s],我得到[对象对象],[对象对象],[对象对象]

var objects = JSON.parse(this.responseText);

for (s in objects) {
    data.push(Titanium.UI.createTableViewRow({title: "ObjectName: "
    + objects[s]
}));

This is my json file:

{
    "new": [],
    "system": [
    {
        "S": "30",
        "T": "20121107130000",
        "L": "213",
        "ObjectName": "14. Rummet"
    },
    {
        "S": "24",
        "T": "20110831163900",
        "L": "202",
        "ObjectName": null
    }
],
    "returnes": []
}

1 个答案:

答案 0 :(得分:0)

您的答案是,如果您想获得密钥对值系统的价值,您需要像这样使用它

var objects = this.responseText;

objects.system[0].S Answer ----> 30 ;

objects.system[1].S Answer ----> 24 ;

objects.system[0].T Answer ----> 20121107130000;

objects.system[0].L Answer ----> 213;

objects.system[0].ObjectName Answer ----> 14. Rummet

objects.system.length Answer ----> 2