I've been trying many different things, but I cannot find a working solution how to find the number of results in an array which is nested in a JSON.
Here is the JSON:
{
"Status":"OK",
"ID":"xxx",
"Results":[ ]
}
And this is the structure of the Results array:
[
{
"Call":{
"ID":1,
"CustomerKey":null,
"CustomerID":null
},
"PingID":4,
"Key":null,
"Properties":[
{
"Name":"OrdinalID",
"Value":"1"
}
],
"CreatedDate":"0001-01-01T00:00:00.000",
"ID":0,
"ObjectID":null
}
]
I am trying to display results in a table. The table should have as many rows as there are results. But I am getting an incorrect number every time.
If I do JSON.length, I get 3, and if I do JSON.Results[0].length I get over 10, where the correct number of results/rows should be 4.
Any idea how to check the length of this?
JSON.Resultsarray ?Resultsarray the one you're asking for,Results.lengthshould do it? In any case we need a Minimal, Reproducible Example to know exactly how to help you better. There are things unclear in this post.foo. In order to retrieve the length of the Results array, you could simply usefoo.Results.length