cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC Creator & Designer Software

DaHu_285096
Contributor II

I have just started using the ultralight cJSON files from Dave Gamble's git ().

GitHub - DaveGamble/cJSON: Ultralightweight JSON parser in ANSI C

I have no issue serializing and parsing strings but there is some issue with the adding numbers to the object. Has anyone else had this issue and know what is happening?

In my code I create several string value pairs no issue like this

cJSON *payload_json = CJSON_CreateObject();

CJSON_AddNumberToObject(payload_json, "range",n);

I have tried numeric variable and fixed number. The object ends up with blank instead of number like { "range":      }

If I use say CJSON_AddStringToObject(payload_json,"result","ok"); I get correct packet {"result":"ok"}

Thanks

0 Likes
1 Solution
Rakshith
Moderator
Moderator

Hi DaHu_285096​,

I have not used the JSON parser that you are referring to. But I found these issues created in the repo that might help you -

  1. Limiting print decimal point
  2. cJSON does not work on non-ASCII systems

Hope this helps,

Thanks and Regards,

Rakshith

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
1 Reply
Rakshith
Moderator
Moderator

Hi DaHu_285096​,

I have not used the JSON parser that you are referring to. But I found these issues created in the repo that might help you -

  1. Limiting print decimal point
  2. cJSON does not work on non-ASCII systems

Hope this helps,

Thanks and Regards,

Rakshith

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes