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