PlatformIO Community

Arduino json parsing

Hi guys…

I am working with platformio, esp32 and with this lib . …

I would like to parse a json coming from the cloud and to print out the payload content…

I have done this code :

void messageHandler(char *topic, byte *payload, unsigned int length)
  Serial.print("incoming: ");

  StaticJsonDocument<200> doc1, doc2;
  deserializeJson(doc1, payload);
  deserializeJson(doc2, doc1["name"]);

  const char *message = doc1["message"];
  const char *message2 = doc1["name"];


How can I print out the payload without knowing in advance?


You can iterate through an a JSON object without knowing its keys in advance: