Dear members of the community,
once we parse json the program knows all of its keys in all levels. can we extract values purely based on location or do we have to get the keys at all the different levels every time?
for example:
Names Default To Here( 1 );
l = Parse JSON(
"[ { \!"name\!": \!"KATIE\!", \!"age\!": 12, \!"sex\!": \!"F\!", \!"height\!": 59, \!"weight\!": 95 }, { \!"name\!": \!"LOUISE\!", \!"age\!": 12, \!"sex\!": \!"F\!", \!"height\!": 61, \!"weight\!": 123 }, { \!"name\!": \!"JANE\!", \!"age\!": 12, \!"sex\!": \!"F\!", \!"height\!": 55, \!"weight\!": 74 } ]"
);
For( i = 1, i <= Length( l ), i++,
Show( l[i] );
); // works just fine
<BR />
For( i = 1, i <= Length( l ), i++,
Show( l[i] );
For( ii = 1, ii <= Length( l[i] ), ii++,
Show( l[i][ii] ); // not working
);
);
l[1]["age"]; // brings "12" without getting the keys of l[1]
l[1][1]; // not working - subscripted key not in map
keys = l[1] << get keys;
l[1][keys[1]]; // brings 12 works fine
For( i = 1, i <= Length( l ), i++,
keys = l[i] << get keys; // can we skip this step?
For( ii = 1, ii <= Length( keys ), ii++,
Show( l[i], l[i][keys[ii]] )
);
);
many thanks!