How to add a JSON object ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi

I only see JSON parser API in SDK (ver 4.0.1) without add JSON object related APIs.

Is there any APIs can help to add(create) a JSON object?  I think if yes that will be easier to programming

Thanks,

0 Likes
1 Reply
Anonymous
Not applicable

Hello GasparLin​,

There is no direct API to create JSON_OBJECT. You can use the following structure for preparing the object

static wiced_json_object_t json_object =

{

    .object_string        = NULL,

    .object_string_length = 0,

    .value_type           = UNKNOWN_JSON_TYPE,

    .value                = NULL,

    .value_length         = 0,

    .parent_object        = NULL

};

Please refer to JSON.C file in the SDK.

Best Regards,

Ramesh Mylavarapu