This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Send Json Payload to californium server

Hello,

I have a question:

i want to send a JSON payload  using the PUT-method from CoAP. For this I am creating my JSON Payload with the following function:

{

cJSON *root = cJSON_CreateObject();
cJSON_AddNumberToObject(root, "JSON", 50);
cJSON_AddNumberToObject(root, "Content-Form", 12);
return root;

}
 

The main function :

cJSON_Init();
cJSON *item = createJsonFromParams();
char *payload=cJSON_Print(item);

What i am sending is this:

{
"JSON": 50,
"Content-Form": 12
}

And what the server gets is : "{\n\t"

test_non_secure.zip

Can someone please help and tell me, why is it like that?

Is it the appropriate way of sending theJSON Payload?

Thanks in advance

Cedric

Parents Reply Children
No Data
Related