-
Notifications
You must be signed in to change notification settings - Fork 9
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
Boolean in Json #13
Comments
Hey! Glad you are getting some use of jsonlib. I'm glad you found a work around! That's the best I can offer right now as I've not looked at this code in a couple years. Justin |
Would you be interested to include this to your lib? I would make a pull requests than. |
Please do. Thank you!
Justin
…On Mon, Dec 5, 2022 at 7:39 AM Kornel Kovacs ***@***.***> wrote:
Would you be interested to include this to your lib? I would make a pull
requests than.
—
Reply to this email directly, view it on GitHub
<#13 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG5AWZO6GVI6MIPG22DUP3WLXPBVANCNFSM6AAAAAASTIG4N4>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Justin
|
Please include any test results you've used.
…On Mon, Dec 5, 2022 at 6:25 PM Justin Shaw ***@***.***> wrote:
Please do. Thank you!
Justin
On Mon, Dec 5, 2022 at 7:39 AM Kornel Kovacs ***@***.***>
wrote:
> Would you be interested to include this to your lib? I would make a pull
> requests than.
>
> —
> Reply to this email directly, view it on GitHub
> <#13 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAG5AWZO6GVI6MIPG22DUP3WLXPBVANCNFSM6AAAAAASTIG4N4>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
--
Justin
--
Justin
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Guys,
I started to use your library, I like is a lot because of it's simplicity and lightness.
I've encountered an issue though, when I need to deserialize a json and retrieve a bool value it seems not to work.
Example json:
{"_id":"637a8b27171c8e5a9","name":"somename","type":"a4","apikey":"someapikey","deviceid":"a48003cb","createdAt":"2022-11-20T20:16:35.783Z","online":true}
example code:
void setup() {
Serial.begin(115200);
String test_json = "{"_id":"637a8b27171c8e5a9","name":"somename","type":"a4","apikey":"someapikey","deviceid":"a48003cb","createdAt":"2022-11-20T20:16:35.783Z","online":true}";
delay(5000);
Serial.println(jsonExtract(test_json, "name")); // result is somename which is good :)
Serial.println(jsonExtract(test_json, "online"));
}
// result is {"_id":"637a8b27171c8e5a9","name":"somename","type":"a4","apikey":"someapikey","deviceid":"a48003cb","createdAt":"2022-11-20T20:16:35.783Z","online":
I was in a hurry so what I did to resolve it is added a few lines to jsonlib.cpp from line 120:
// bool
else if(json.substring(start, start + 4) == "true"){
stop = start + 4;
}
else if (json.substring(start, start + 5) == "false"){
stop = start + 5;
}
This way it interprets bool now.
Please let me know if there is an another way to do that.
Thanks in advance,
Kornel
The text was updated successfully, but these errors were encountered: