1 Reply Latest reply on Aug 26, 2020 6:36 AM by RakshithM_16

    Problem with cJSON module


      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"}