35 #define cJSON_Number 3
36 #define cJSON_String 4
38 #define cJSON_Object 6
40 #define cJSON_IsReference 256
44 struct cJSON *next,*prev;
57 void *(*malloc_fn)(
size_t sz);
58 void (*free_fn)(
void *ptr);
66 extern cJSON *cJSON_Parse(
const char *value);
68 extern char *cJSON_Print(
cJSON *item);
70 extern char *cJSON_PrintUnformatted(
cJSON *item);
72 extern void cJSON_Delete(
cJSON *c);
75 extern int cJSON_GetArraySize(
cJSON *array);
77 extern cJSON *cJSON_GetArrayItem(
cJSON *array,
int item);
79 extern cJSON *cJSON_GetObjectItem(
cJSON *
object,
const char *
string);
82 extern const char *cJSON_GetErrorPtr(
void);
85 extern cJSON *cJSON_CreateNull(
void);
86 extern cJSON *cJSON_CreateTrue(
void);
87 extern cJSON *cJSON_CreateFalse(
void);
88 extern cJSON *cJSON_CreateBool(
int b);
89 extern cJSON *cJSON_CreateNumber(
double num);
90 extern cJSON *cJSON_CreateString(
const char *
string);
91 extern cJSON *cJSON_CreateArray(
void);
92 extern cJSON *cJSON_CreateObject(
void);
95 extern cJSON *cJSON_CreateIntArray(
int *numbers,
int count);
96 extern cJSON *cJSON_CreateFloatArray(
float *numbers,
int count);
97 extern cJSON *cJSON_CreateDoubleArray(
double *numbers,
int count);
98 extern cJSON *cJSON_CreateStringArray(
const char **strings,
int count);
101 extern void cJSON_AddItemToArray(
cJSON *array,
cJSON *item);
102 extern void cJSON_AddItemToObject(
cJSON *
object,
const char *
string,
cJSON *item);
104 extern void cJSON_AddItemReferenceToArray(
cJSON *array,
cJSON *item);
105 extern void cJSON_AddItemReferenceToObject(
cJSON *
object,
const char *
string,
cJSON *item);
108 extern cJSON *cJSON_DetachItemFromArray(
cJSON *array,
int which);
109 extern void cJSON_DeleteItemFromArray(
cJSON *array,
int which);
110 extern cJSON *cJSON_DetachItemFromObject(
cJSON *
object,
const char *
string);
111 extern void cJSON_DeleteItemFromObject(
cJSON *
object,
const char *
string);
114 extern void cJSON_ReplaceItemInArray(
cJSON *array,
int which,
cJSON *newitem);
115 extern void cJSON_ReplaceItemInObject(
cJSON *
object,
const char *
string,
cJSON *newitem);
118 extern cJSON *cJSON_Duplicate(
cJSON *item,
int recurse);
124 extern cJSON *cJSON_ParseWithOpts(
const char *value,
const char **return_parse_end,
int require_null_terminated);
127 #define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
128 #define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
129 #define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
130 #define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
131 #define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
132 #define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
135 #define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))