I am having the following code:
JSONObject json;
int max;
void setup() {
size(500,500);
JSONObject json = loadJSONObject("january_2016.json");
JSONObject maxTemperature = json.getJSONObject("Max Temperature");
int max = maxTemperature.getInt("max");
print(max);
}
void draw(){
ellipse(max, 10, 100, 100);
}
And my Json file:
[
{
"Max Temperature": {
"max": "18",
"avg": "6",
"min": "-2"
}
]
When I run the code now I get the following error: JSONObject must begin with {
I understood that because of the [ ] I need to use JSONArray but if I changeJSONObject json = loadJSONObject("january_2016.json");<br>
to JSONArray, I get this error:The method getJSONObject(int) in the type JSONArray is not applicable for the arguments (String)
I am sure it must be simple but I am a pretty new to this, so thanks in advance