-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When SerializeJson(doc, file) to a file the last charachters are missing in the file #1732
Comments
Hi @chess-levin, First, make sure that you call This issue may be a duplicate of #1695, which seems to be caused by esp8266/Arduino#8372. Best regards, |
Hello @bblanchon, thank you for your Feedback.
If it is a problem with long Strings as mentioned here #1695 why is my workaround successful? I do serialize the whole JSON struct to a String buf and write it to a SPIFFS file. See workarond code below:
How do I downgrade the ESP Core Lib? Can't find the dependency in my project platform.ini lib_deps section. I have no idea... |
To downgrade ESP8266 core to version 2.7.4, set the following value in your platform = espressif8266@2.6.2 PlatformIO should download the requested version automatically. Note that the "platform" version is 2.6.2, and not 2.7.4, as you may expect. |
Describe the issue
I'm trying to write a struct with config data to a json file. But the last few characters (always the closing curly brackets) are always missing when I read the file again. My work around is to serialize the data to a json String buffer and then writing this buffer to the file. Why does serializeJson(doc, file) not work correctly?
The complete process looks like this:
Troubleshooter report
ArduinoJson Troubleshooter's report
serializeJson()
produces garbagedeserializeJson()
serializeJson(const JsonDocument&, ...)
DynamicJsonDocument
String
Environment
Here is the environment that I'm using':
PLATFORM: Espressif 8266 (3.2.0) > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Reproduction
This is the json structure
This is the config struct that holds the config data im memory:
and this my function to serialize the struct into a DynamicJsonDocument:
Program output
Expected output:
Actual output:
The text was updated successfully, but these errors were encountered: