Skip to content
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

Non blocking deserialize #1690

Closed
dbagnara opened this issue Dec 19, 2021 · 2 comments
Closed

Non blocking deserialize #1690

dbagnara opened this issue Dec 19, 2021 · 2 comments
Labels
v6 ArduinoJson 6

Comments

@dbagnara
Copy link

Is there a way to prevent deserialize from blocking?

For example, is it possible to either push a stream into the JsonDocument using a ficticious method addSerialData()
StaticJsonDocument<256> doc ; doc.addSerialData( "[1," ); doc.addSerialData( '2' ); doc.addSerialData( ",3]" );

Or resume a partial deserialization.

StaticJsonDocument<256> doc ; deserializeJson( doc, "[1,2," ); deserializeJson( doc, "3]" );

Thanks

@bblanchon
Copy link
Owner

Hi @dbagnara,

No, ArduinoJson doesn't support incremental/partial deserialization.
I wish to add this feature at some point, but I'm afraid it will increase the code size dramatically.

As a workaround, I suggest that you use a StringStream as a temporary buffer and call deserializeJson() when the message is complete.

Best regards,
Benoit

@dbagnara
Copy link
Author

Thanks.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 19, 2022
@bblanchon bblanchon added the v6 ArduinoJson 6 label Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
v6 ArduinoJson 6
Projects
None yet
Development

No branches or pull requests

2 participants