I am using UnityWebRequest to get a query and parse it in JSON. Everything works as expected but here the node users
is an array that is defined as below:
{
"data": {
"users": [
{
"id": "981d8432-c423-46e1-9124-5b5f111bd749",
},
{
"id": "11cd2db5-3e6e-4363-b8e5-afd2a67a5333",
}
]
}
Now I know that the array is 2 values but how do I make the for loop detect it by the length? Such that
using SimpleJSON;
...
...
void Start()
{
JSONNode itemsData = JSON.Parse (request.downloadHandler.text);
for(int i = 0;i<(LengthOfUsers); i++)
{
Debug.Log("\nIDs: "+ itemsData["data"]["users"][i]["id"]);
}
}