Wednesday 15 June 2011

javascript - Arrays nested in array JSON - how to access properties -


There has been conflict with some JSON which has been provided to me. It is in this format:

  [[{"item": [{"id": "xxxxxxx", "name": "xxxxxxxxxx", "description": "xxxxxxxxxxx"}, {"Id": "xxxxxxx", "name": "xxxxxxxxxx", "description": "xxxxxxxxxxx"}], "parent id": "xxxxxxxx", "title": "xxxxxxxxx", "type": "xxxxxxx" } "Name": "xxxxxxxxxx", "name": "xxxxxxxxxx", "description": "xxxxxxxxxxx"}, {"id": "xxxxxxx", "name": "xxxxxxxxxx "," Description ":" xxxxxxxxxxx "}]," parent id ":" xxxxxxxx "," title ":" xxxxxxxxx "," type ":" xxxxxxx "}]   

I have an object with the name 'data', if I wire 'data' then it is up to me. Basically I have a parent and I I need to look at that original ID in that JSN.I have not been used for this structure and I am trying to find a simple solution. To do something like 'item' at the top level Is used and can be drilled through that medium.

  (var I = 0; I & lt; Data.length; I ++) {if (data [i] [0] .parent id == 'yourParent_id') // stuff}    

No comments:

Post a Comment