-
Notifications
You must be signed in to change notification settings - Fork 77
Premature termination JSON output #96
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
Comments
This sounds like ArduinoJson might not be able to size up the buffer past a certain point. It's possible that my migration to ArduinoJson 6 in #95 will fix this issue but testing that out would require manually checking out that branch and making sure you upgrade your local ArduinoJson. As a workaround, you could move some of the properties to a second thing and add both to the adapter with multiple calls to |
Thanks @hobinjk for your suggestions. I have checked out your branch and compiled my project with ArduinoJson 6.13.0. The generated JSON was no longer broken, but only showed the first two Things in the JSON generated. Could this be an issue with your branch? Might be worth checking out for proper ArduinoJson 6 integration. The work-around didn't work for me, unfortunately. I was actually already adding Things/Devices instead of properties. I'll rephrase my initial issue accordingly. |
Working with an ESP32. |
You may want to try changing the size of some of the JSON buffers. For instance:
They're set fairly small by default. |
Thank you @mrstegeman |
The buffer sizes are now configurable as such: // By default, buffers are 256 bytes for small documents, 1024 for larger ones
// To use a pre-defined set of larger JSON buffers (4x larger)
#define LARGE_JSON_BUFFERS 1
// Else, you can define your own size
#define SMALL_JSON_DOCUMENT_SIZE <something>
#define LARGE_JSON_DOCUMENT_SIZE <something> |
Working with an ESP8266 (NodeMCU v3) I'm having issues with JSON output being truncated. Resulting in invalid JSON data.
I'm adding 11 things using
adapter->addDevice
:Surfing to
http://MY-IP/
my browser shows the error:SyntaxError: JSON.parse: unterminated string at line 1 column 3612 of the JSON data
Not adding either the LED or motion sensor property makes the sketch return valid JSON data.
https://gist.github.com/qistoph/bfdf8601969078be9284bcf6224351bf#file-thingmcp23008-ino-L98
Below are the number of characters returned, determined with
curl 'http://MY-IP/' | wc -c
:3860
(invalid JSON because of termination)4817
4796
If anyone has any suggestions to fix or further troubleshoot the issue, I'd love to hear from you.
The text was updated successfully, but these errors were encountered: