Right now I'm struggling with calculating the size of a cJSON
object. So far, I have done this:
cJSON *payload = cJSON_CreateObject();
...
size_t size_payload = sizeof(payload);
Obviously I initialize the payload object and I print into the terminal to verify the integrity of the data and it is ok. However, after printing the sizeof
result, it is always 4 as the number of bytes, but for a long string (as mine) it should be around 500 bytes.
Am I missing something here handling cJSON
object?
Hope you can help, or maybe give me an example of how to get the proper value of the entire size.