i have a nested json file ( see attachment )
i use arduinoAssistant to parse all my data. (see 2nd attachment)
this works fine ,
but there is a part in the code that i want to use in a 'normal ' for loop , so i can use an index to go throught al my element one by one..
this part is what i want to convert to a forloop (now the code is more action as a foreach-loop ..
for (JsonObject elem : day_5["hour"].as<JsonArray>()) {
const char* interval = elem["interval"]; // "01:00", "04:00", "07:00", "10:00", "13:00", "16:00", ...
const char* temp = elem["temp"]; // "1", "1", "0", "3", "5", "5", "4", "2"
const char* symbol_value = elem["symbol_value"]; // "3", "3", "3", "3", "4", "4", "3", "3"
const char* symbol_description = elem["symbol_description"]; // "Bewolkt", "Bewolkt", "Bewolkt", ...
const char* symbol_value2 = elem["symbol_value2"]; // "3", "3", "3", "3", "4", "4", "3", "3"
const char* symbol_description2 = elem["symbol_description2"]; // "Bewolkt", "Bewolkt", "Bewolkt", ...
JsonObject wind = elem["wind"];
const char* wind_speed = wind["speed"]; // "6", "5", "4", "3", "3", "1", "5", "7"
const char* wind_dir = wind["dir"]; // "NE", "NE", "NE", "E", "E", "E", "NW", "NW"
const char* wind_symbol = wind["symbol"]; // "2", "2", "2", "3", "3", "3", "8", "8"
const char* wind_symbolB = wind["symbolB"]; // "26", "18", "18", "27", "27", "27", "24", "32"
const char* wind_gusts = wind["gusts"]; // "19", "11", "8", "12", "15", "14", "10", "13"
const char* rain = elem["rain"]; // "0", "0", "0", "0", "0", "0", "0", "0"
const char* humidity = elem["humidity"]; // "82", "75", "82", "57", "52", "51", "64", "73"
const char* pressure = elem["pressure"]; // "1024", "1024", "1024", "1024", "1024", "1022", "1022", ...
const char* clouds = elem["clouds"]; // "71%", "87%", "67%", "59%", "99%", "100%", "81%", "84%"
const char* snowline = elem["snowline"]; // "400", "400", "300", "300", "400", "500", "500", "500"
const char* windchill = elem["windchill"]; // "0", "1", "-1", "3", "5", "8", "3", "0"
const char* uv_index = elem["uv_index"]; // "0", "0", "0", "1", "1", "0", "0", "0"
}
and my desired code is
for (byte i = 1 ; i < 6 ; i ++)
{
a =day[1] interval[i];
b = day[1]temp[i];
}
jsonbruss.txt (33.7 KB)
jsonassist.txt (20.3 KB)