r-downing / PersWiFiManager

Persistent WiFiManager Arduino library for ESP8266
http://ryandowning.net/PersWiFiManager/
MIT License
111 stars 34 forks source link

Upgrade to ArduinoJson V6 #35

Open juppwerner opened 3 years ago

juppwerner commented 3 years ago

Hello,

I tested the example spiffs_rest_api_nonblocking.

In order to make this work with the current ArduinoJson V6.16.1, I replaced in functiom "server.on("/api", []() {}" around line 82:

//build json object of program data
const int capacity = JSON_OBJECT_SIZE(3);
StaticJsonDocument<capacity> doc;
// JsonObject json = jsonDoc.as<JsonObject>();
doc["x"] = x;
doc["y"] = y;

char jsonchar[200];
serializeJson(doc, jsonchar); //print to char array, takes more memory but sends in one piece
DEBUG_PRINT(jsonchar);

Regards

Joachim Werner

HA4ever37 commented 3 years ago

This version works with ArduinoJson v6 https://github.com/HA4ever37/SPIFFSReadServer