I have the following JSON array:
{
"data":
{
"array":
[
{
"type1":
{
...
}
},
{
"type2":
{
...
}
},
{
"type3":
{
...
}
},
{
"type3":
{
...
}
},
{
"type3":
{
...
}
},
{
"type3":
{
...
}
},
...
]
}
}
I would like to work with the
type3 nodes for what i have the following Pascal code:
JSON := GetJSON(the_json_above);
TMPJSON := JSON.FindPath('data.array');
l := TMPJSON.Count - 1;
q := 0;
for r := 0 to l do
begin
TMPJSON1 := TMPJSON.Items[r].FindPath('type3');
if (TMPJSON1 <> nil) then
begin
inc(q);
if (q = 20) then
begin
break;
end;
end;
end;
This causes crash. The parser finds
data.array, as the debugger shows
TMPJSON.Count correctly.
How can one iterate the JSON arrays?