Hi, I have got the json data, its really long and has a lot of nested data which i need. If the json looks like this :
result
[{
"description":"eyes",
"measurement_locations":
[{
"AOI_radius_o":81.73,
"AOI_x_o":445.06740399339611,
"AOI_y_o":1147.187748624817,
"description":"left eye",
"measures":
[
{
"description":"eyebags",
"value":0.095144319232841418,
"value_raw":null
},
{
"description":"dark circles",
"value":0.18982207370058865,
"value_raw":null
}
],
"value":0.18982207370058865,
"value_raw":null,
"visualization_data":null
},
{
"AOI_radius_o":81.73,
"AOI_x_o":720.56740399339606,
"AOI_y_o":1127.6877486248172,
"description":"right eye"
,"measures":
[
{
"description":"eyebags",
"value":0.092195747704466202,
"value_raw":null
},
{
"description":"dark circles",
"value":0.23332688013566055,
"value_raw":null}],
"value":0.23332688013566055,
"value_raw":null,"visualization_data":null
}],
"message":"Ok",
"value":0.21157447691812459,
"value_raw":null
}]
i can get the description, and value but I’m not sure how to get the nested data like measurement_locations. How i get the “top level” data is by for loop like :
public List<string> description;
public List<float> value;
public void ReceiveResults(string jsonstring)
{
Debug.Log("ReceiveResults function");
ApiResponse response = JsonUtility.FromJson<ApiResponse>(jsonstring);
for (int i = 0; i < response.results.Count; i++)
{
description.Add(response.results*.description);*
value.Add(response.results*.value);*
}
}
public class ApiResponse
{
public List results;
}
[System.Serializable]
public class SkinResult
{
public string description;
//Not sure what to do with this
public List<Measurement_Location> measurement_locations;
public float value;
}
[System.Serializable]
public class Measurement_Location
{
public float AOI_x_o;
public float AOI_y_o;
public string description;
}