Hello
my arduino can receive the following jsons:
{"release":"{"quantity":"50"}"}
or
{"diet":"{[{"schedule":"08:00","grams":50},{"schedule":"12:00","grams":50}]}"}
how can i check if i got a json with the command "release" or "diet". Let's say I received the "release" command, how can I retrieve the quantity information (50)?
My code:
//deserealize JSON
DeserializationError error = deserializeJson(doc, F("{\"release\":{\"quantity\":\"50\"}}"));
if (error) {
Console.print(F("deserializeJson() failed: "));
Console.println(error.f_str());
} else {
const char* release= doc["release"];
if (release) {
Console.println("ok, we received a "release" command");
return;
}
thanks