Loading
Loading
IoT Lab content is currently available in Arabic only. We're working on an English version.
عرض بالعربية →How the ESP32 understands complex data coming from the web.
#include <ArduinoJson.h>
void setup() {
Serial.begin(9600);
String input = "{\"temp\":25, \"city\":\"Riyadh\"}";
StaticJsonDocument<200> doc;
deserializeJson(doc, input);
int t = doc["temp"]; // 25
String c = doc["city"]; // Riyadh
Serial.println(t);
}
void loop() {}Allocating a buffer (memory size) for the JSON document smaller than the actual size of the received data, causing silent parsing failure.