cJSON是一个轻量级的C语言库,用于解析和生成JSON数据。它仅包含两个文件:cJSON.c和cJSON.h,便于集成到各种项目中。
#define cJSON_False 0
#define cJSON_True 1
#define cJSON_NULL 2
#define cJSON_Number 3
#define cJSON_String 4
#define cJSON_Array 5
#define cJSON_Object 6
#define cJSON_IsReference 256
#define cJSON_StringIsConst 512
/* The structure for a JSON item: */
typedef struct cJSON {
struct cJSON *next, *prev; /* next/prev allow you to walk through array or object chains. Alternatively, use GetArraySize, GetArrayItem, and GetObjectItem functions */
struct cJSON *child; /* For an array or object element, the child pointer points to a sub-element */
}