I'm not 100% clear how to formulate a $.each()
function.
The following JSON data block contains multiple items in the array ItemValues
. What I'm looking for is a method (because this packet can be arbitrarily large) is somewhat to get each ItemValue
array item WHERE Fields.Id
is equivalent to some value "x".
As well, is there some method to retrieve ItemValues[n].Fields.units
as an array?
JSON:
{
"CacheName":"Default",
"LastUpdateTime":"\/Date(1396994130568)\/",
"Type":"Start",
"TotalItemsCount":3,
"PassingFilterCount":3,
"ItemValues":[
{
"Fields":{
"id":"13288263",
"status":"8",
"x_cord":"7250600",
"y_cord":"566620200",
"code":"1021",
"sub_code":"1W",
"priority":"1",
"units":"1011, 1130, 1201, 1233, 1445, 1501, 1518, 1714, 1726, 1823, 1825, 1832, 3662",
"ts":"20140402234025UT"
},
"Id":"13288263",
"LastAction":"add"
},
{
"Fields":{
"id":"13288264",
"status":"8",
"x_cord":"",
"y_cord":"",
"code":"",
"sub_code":"",
"priority":"-1",
"units":"",
"ts":""
},
"Id":"13288264",
"LastAction":"add"
},
{
"Fields":{
"id":"13288265",
"status":"8",
"x_cord":"",
"y_cord":"",
"code":"",
"sub_code":"",
"priority":"-1",
"units":"",
"ts":""
},
"Id":"13288265",
"LastAction":"add"
}
]
}