The cJSON structure:
| next | cJSON * | |
| prev | cJSON * | |
| child | cJSON * |
next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem |
| type | int |
An array or object item will have a child pointer pointing to a chain of the items in the array/object. |
| valuestring | char * |
The type of the item, as above. |
| valueint | int |
The item's string, if type==cJSON_String |
| valuedouble | double |
The item's number, if type==cJSON_Number |
| string | char * |
The item's number, if type==cJSON_Number |
Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON.
| array | |
| item |
| object | |
| string | |
| item |
Append item to the specified array/object.
| array | |
| item |
| object | |
| string | |
| item |
| cJSON_DeleteItemFromArray | ( | cJSON * | array, | |
| int | which | ) | ||
| array | |
| which |
| cJSON_DeleteItemFromObject | ( | cJSON * | object, | |
| char const * | string | ) | ||
| object | |
| string |
Remove/Detatch items from Arrays/Objects.
| array | |
| which | |
| return |
Retrieve item number "item" from array "array". Returns NULL if unsuccessful.
| array | |
| item | |
| return |
| cJSON_GetArraySize | ( | cJSON * | array | ) |
Returns the number of items in an array (or object).
| array | |
| return |
Get item "string" from object. Case insensitive.
| object | |
| string | |
| return |
Update array items.
| array | |
| which | |
| newitem |
| cJSON_Print | ( | cJSON * | item | ) |
Render a cJSON entity to text for transfer/storage. Free the char* when finished.
| item | |
| return |
| cJSON_PrintBuffered | ( | cJSON * | item, | |
| int | prebuffer, | |||
| int | fmt | ) | ||
Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted
| item | |
| prebuffer | |
| fmt | |
| return |
| cJSON_PrintUnformatted | ( | cJSON * | item | ) |
Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished.
| item | |
| return |
Shifts pre-existing items to the right.
| array | |
| which | |
| newitem |