Hi, how to deserialize nested json objects using json 7.
example:
data : {"time":"2024-05-19","M60:{"E_in":500.0,"Power":47.1}}
how to get E_in ?
Thank you
use the assistant
(you are missing a double quote for M60)
char input[] = "{\"time\":\"2024-05-19\",\"M60\":{\"E_in\":500.0,\"Power\":47.1}}";
JsonDocument doc;
DeserializationError error = deserializeJson(doc, input);
if (!error) {
const char* time = doc["time"]; // "2024-05-19"
int M60_E_in = doc["M60"]["E_in"]; // 500
float M60_Power = doc["M60"]["Power"]; // 47.1
...
}
Thank you . Now it is completely logical.
BLEIB GESUND Klaus-Dieter ![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.