We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
volatile float
int
With the last update of the library, i get floats variable serialized as ints variable. I'm using a ESP32.
This is the code you need:
volatile float distance; volatile int state; StaticJsonDocument<128> doc;
doc["type"] = "data"; doc["state"] = state; Serial.println(distance); doc["distance"] = distance; serializeJson(doc, msg); doc.clear(); Serial.println(msg);
From the prints i get: 5.74 {"type":"data","state":2,"distance":5}
I don't get this issue using a non volatile variable. Bye
The text was updated successfully, but these errors were encountered:
Added support cv-qualified types in is_floating_point (fixes #1557)
9c566da
Hi @aleshark87,
Thank you very much for reporting this issue 👍 I'll fix the bug in branch 6.x very soon.
6.x
As a workaround, you can cast to float:
float
doc["distance"] = (float)distance;
Best regards, Benoit
Sorry, something went wrong.
326da76
622e7dd
The fix is included in ArduinoJson 6.18.1
No branches or pull requests
With the last update of the library, i get floats variable serialized as ints variable.
I'm using a ESP32.
This is the code you need:
From the prints i get:
5.74
{"type":"data","state":2,"distance":5}
I don't get this issue using a non volatile variable.
Bye
The text was updated successfully, but these errors were encountered: