Question

Im trying to get the value 'ObjectName' from the json file belllow.

I have tried to do like this: If I wright objects[s], Im getting [object Object],[object Object],[object Object]

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": []
}
Was it helpful?

Solution

Your answer is if you want to get the value of keypair value system you need to use it like this way

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top