xt-sdk 文档 v1.0.3
xt-sdk 嵌入式 SDK API 参考
载入中...
搜索中...
未找到
cJSON(JSON 解析器)

cJSON(JSON 解析器) 更多...

结构体

struct  cJSON
struct  cJSON_Hooks

宏定义

#define CJSON_CDECL
#define CJSON_STDCALL
#define CJSON_PUBLIC(type)
#define CJSON_VERSION_MAJOR   1
#define CJSON_VERSION_MINOR   7
#define CJSON_VERSION_PATCH   13
#define cJSON_Invalid   (0)
#define cJSON_False   (1 << 0)
#define cJSON_True   (1 << 1)
#define cJSON_NULL   (1 << 2)
#define cJSON_Number   (1 << 3)
#define cJSON_String   (1 << 4)
#define cJSON_Array   (1 << 5)
#define cJSON_Object   (1 << 6)
#define cJSON_Raw   (1 << 7) /* raw json */
#define cJSON_IsReference   256
#define cJSON_StringIsConst   512
#define CJSON_NESTING_LIMIT   1000
#define cJSON_SetIntValue(object, number)
#define cJSON_SetNumberValue(object, number)
#define cJSON_ArrayForEach(element, array)

类型定义

typedef struct cJSON cJSON
typedef struct cJSON_Hooks cJSON_Hooks
typedef int cJSON_bool

函数

const char * cJSON_Version (void)
void cJSON_InitHooks (cJSON_Hooks *hooks)
cJSON * cJSON_Parse (const char *value)
cJSON * cJSON_ParseWithLength (const char *value, size_t buffer_length)
cJSON * cJSON_ParseWithOpts (const char *value, const char **return_parse_end, cJSON_bool require_null_terminated)
cJSON * cJSON_ParseWithLengthOpts (const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated)
char * cJSON_Print (const cJSON *item)
char * cJSON_PrintUnformatted (const cJSON *item)
char * cJSON_PrintBuffered (const cJSON *item, int prebuffer, cJSON_bool fmt)
cJSON_bool cJSON_PrintPreallocated (cJSON *item, char *buffer, const int length, const cJSON_bool format)
void cJSON_Delete (cJSON *item)
int cJSON_GetArraySize (const cJSON *array)
cJSON * cJSON_GetArrayItem (const cJSON *array, int index)
cJSON * cJSON_GetObjectItem (const cJSON *const object, const char *const string)
cJSON * cJSON_GetObjectItemCaseSensitive (const cJSON *const object, const char *const string)
cJSON_bool cJSON_HasObjectItem (const cJSON *object, const char *string)
const char * cJSON_GetErrorPtr (void)
char * cJSON_GetStringValue (cJSON *item)
double cJSON_GetNumberValue (cJSON *item)
cJSON_bool cJSON_IsInvalid (const cJSON *const item)
cJSON_bool cJSON_IsFalse (const cJSON *const item)
cJSON_bool cJSON_IsTrue (const cJSON *const item)
cJSON_bool cJSON_IsBool (const cJSON *const item)
cJSON_bool cJSON_IsNull (const cJSON *const item)
cJSON_bool cJSON_IsNumber (const cJSON *const item)
cJSON_bool cJSON_IsString (const cJSON *const item)
cJSON_bool cJSON_IsArray (const cJSON *const item)
cJSON_bool cJSON_IsObject (const cJSON *const item)
cJSON_bool cJSON_IsRaw (const cJSON *const item)
cJSON * cJSON_CreateNull (void)
cJSON * cJSON_CreateTrue (void)
cJSON * cJSON_CreateFalse (void)
cJSON * cJSON_CreateBool (cJSON_bool boolean)
cJSON * cJSON_CreateNumber (double num)
cJSON * cJSON_CreateString (const char *string)
cJSON * cJSON_CreateRaw (const char *raw)
cJSON * cJSON_CreateArray (void)
cJSON * cJSON_CreateObject (void)
cJSON * cJSON_CreateStringReference (const char *string)
cJSON * cJSON_CreateObjectReference (const cJSON *child)
cJSON * cJSON_CreateArrayReference (const cJSON *child)
cJSON * cJSON_CreateIntArray (const int *numbers, int count)
cJSON * cJSON_CreateFloatArray (const float *numbers, int count)
cJSON * cJSON_CreateDoubleArray (const double *numbers, int count)
cJSON * cJSON_CreateStringArray (const char *const *strings, int count)
cJSON_bool cJSON_AddItemToArray (cJSON *array, cJSON *item)
cJSON_bool cJSON_AddItemToObject (cJSON *object, const char *string, cJSON *item)
cJSON_bool cJSON_AddItemToObjectCS (cJSON *object, const char *string, cJSON *item)
cJSON_bool cJSON_AddItemReferenceToArray (cJSON *array, cJSON *item)
cJSON_bool cJSON_AddItemReferenceToObject (cJSON *object, const char *string, cJSON *item)
cJSON * cJSON_DetachItemViaPointer (cJSON *parent, cJSON *const item)
cJSON * cJSON_DetachItemFromArray (cJSON *array, int which)
void cJSON_DeleteItemFromArray (cJSON *array, int which)
cJSON * cJSON_DetachItemFromObject (cJSON *object, const char *string)
cJSON * cJSON_DetachItemFromObjectCaseSensitive (cJSON *object, const char *string)
void cJSON_DeleteItemFromObject (cJSON *object, const char *string)
void cJSON_DeleteItemFromObjectCaseSensitive (cJSON *object, const char *string)
cJSON_bool cJSON_InsertItemInArray (cJSON *array, int which, cJSON *newitem)
cJSON_bool cJSON_ReplaceItemViaPointer (cJSON *const parent, cJSON *const item, cJSON *replacement)
cJSON_bool cJSON_ReplaceItemInArray (cJSON *array, int which, cJSON *newitem)
cJSON_bool cJSON_ReplaceItemInObject (cJSON *object, const char *string, cJSON *newitem)
cJSON_bool cJSON_ReplaceItemInObjectCaseSensitive (cJSON *object, const char *string, cJSON *newitem)
cJSON * cJSON_Duplicate (const cJSON *item, cJSON_bool recurse)
cJSON_bool cJSON_Compare (const cJSON *const a, const cJSON *const b, const cJSON_bool case_sensitive)
void cJSON_Minify (char *json)
cJSON * cJSON_AddNullToObject (cJSON *const object, const char *const name)
cJSON * cJSON_AddTrueToObject (cJSON *const object, const char *const name)
cJSON * cJSON_AddFalseToObject (cJSON *const object, const char *const name)
cJSON * cJSON_AddBoolToObject (cJSON *const object, const char *const name, const cJSON_bool boolean)
cJSON * cJSON_AddNumberToObject (cJSON *const object, const char *const name, const double number)
cJSON * cJSON_AddStringToObject (cJSON *const object, const char *const name, const char *const string)
cJSON * cJSON_AddRawToObject (cJSON *const object, const char *const name, const char *const raw)
cJSON * cJSON_AddObjectToObject (cJSON *const object, const char *const name)
cJSON * cJSON_AddArrayToObject (cJSON *const object, const char *const name)
double cJSON_SetNumberHelper (cJSON *object, double number)
char * cJSON_SetValuestring (cJSON *object, const char *valuestring)
void * cJSON_malloc (size_t size)
void cJSON_free (void *object)

详细描述

cJSON(JSON 解析器)

宏定义说明

◆ cJSON_Array

#define cJSON_Array   (1 << 5)

在文件 cJSON.h 第 105 行定义.

◆ cJSON_ArrayForEach

#define cJSON_ArrayForEach ( element,
array )
值:
for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)

在文件 cJSON.h 第 293 行定义.

◆ CJSON_CDECL

#define CJSON_CDECL

在文件 cJSON.h 第 81 行定义.

◆ cJSON_False

#define cJSON_False   (1 << 0)

在文件 cJSON.h 第 100 行定义.

◆ cJSON_Invalid

#define cJSON_Invalid   (0)

在文件 cJSON.h 第 99 行定义.

◆ cJSON_IsReference

#define cJSON_IsReference   256

在文件 cJSON.h 第 109 行定义.

◆ CJSON_NESTING_LIMIT

#define CJSON_NESTING_LIMIT   1000

在文件 cJSON.h 第 147 行定义.

◆ cJSON_NULL

#define cJSON_NULL   (1 << 2)

在文件 cJSON.h 第 102 行定义.

◆ cJSON_Number

#define cJSON_Number   (1 << 3)

在文件 cJSON.h 第 103 行定义.

◆ cJSON_Object

#define cJSON_Object   (1 << 6)

在文件 cJSON.h 第 106 行定义.

◆ CJSON_PUBLIC

#define CJSON_PUBLIC ( type)
值:
type

在文件 cJSON.h 第 87 行定义.

◆ cJSON_Raw

#define cJSON_Raw   (1 << 7) /* raw json */

在文件 cJSON.h 第 107 行定义.

◆ cJSON_SetIntValue

#define cJSON_SetIntValue ( object,
number )
值:
((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))

在文件 cJSON.h 第 285 行定义.

◆ cJSON_SetNumberValue

#define cJSON_SetNumberValue ( object,
number )
值:
((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
double cJSON_SetNumberHelper(cJSON *object, double number)

在文件 cJSON.h 第 288 行定义.

◆ CJSON_STDCALL

#define CJSON_STDCALL

在文件 cJSON.h 第 82 行定义.

◆ cJSON_String

#define cJSON_String   (1 << 4)

在文件 cJSON.h 第 104 行定义.

◆ cJSON_StringIsConst

#define cJSON_StringIsConst   512

在文件 cJSON.h 第 110 行定义.

◆ cJSON_True

#define cJSON_True   (1 << 1)

在文件 cJSON.h 第 101 行定义.

◆ CJSON_VERSION_MAJOR

#define CJSON_VERSION_MAJOR   1

在文件 cJSON.h 第 92 行定义.

◆ CJSON_VERSION_MINOR

#define CJSON_VERSION_MINOR   7

在文件 cJSON.h 第 93 行定义.

◆ CJSON_VERSION_PATCH

#define CJSON_VERSION_PATCH   13

在文件 cJSON.h 第 94 行定义.

类型定义说明

◆ cJSON

typedef struct cJSON cJSON

◆ cJSON_bool

typedef int cJSON_bool

在文件 cJSON.h 第 142 行定义.

◆ cJSON_Hooks

typedef struct cJSON_Hooks cJSON_Hooks

函数说明

◆ cJSON_AddArrayToObject()

cJSON * cJSON_AddArrayToObject ( cJSON *const object,
const char *const name )

◆ cJSON_AddBoolToObject()

cJSON * cJSON_AddBoolToObject ( cJSON *const object,
const char *const name,
const cJSON_bool boolean )

◆ cJSON_AddFalseToObject()

cJSON * cJSON_AddFalseToObject ( cJSON *const object,
const char *const name )

◆ cJSON_AddItemReferenceToArray()

cJSON_bool cJSON_AddItemReferenceToArray ( cJSON * array,
cJSON * item )

◆ cJSON_AddItemReferenceToObject()

cJSON_bool cJSON_AddItemReferenceToObject ( cJSON * object,
const char * string,
cJSON * item )

◆ cJSON_AddItemToArray()

cJSON_bool cJSON_AddItemToArray ( cJSON * array,
cJSON * item )

◆ cJSON_AddItemToObject()

cJSON_bool cJSON_AddItemToObject ( cJSON * object,
const char * string,
cJSON * item )

◆ cJSON_AddItemToObjectCS()

cJSON_bool cJSON_AddItemToObjectCS ( cJSON * object,
const char * string,
cJSON * item )

◆ cJSON_AddNullToObject()

cJSON * cJSON_AddNullToObject ( cJSON *const object,
const char *const name )

◆ cJSON_AddNumberToObject()

cJSON * cJSON_AddNumberToObject ( cJSON *const object,
const char *const name,
const double number )

◆ cJSON_AddObjectToObject()

cJSON * cJSON_AddObjectToObject ( cJSON *const object,
const char *const name )

◆ cJSON_AddRawToObject()

cJSON * cJSON_AddRawToObject ( cJSON *const object,
const char *const name,
const char *const raw )

◆ cJSON_AddStringToObject()

cJSON * cJSON_AddStringToObject ( cJSON *const object,
const char *const name,
const char *const string )

◆ cJSON_AddTrueToObject()

cJSON * cJSON_AddTrueToObject ( cJSON *const object,
const char *const name )

◆ cJSON_Compare()

cJSON_bool cJSON_Compare ( const cJSON *const a,
const cJSON *const b,
const cJSON_bool case_sensitive )

◆ cJSON_CreateArray()

cJSON * cJSON_CreateArray ( void )

◆ cJSON_CreateArrayReference()

cJSON * cJSON_CreateArrayReference ( const cJSON * child)

◆ cJSON_CreateBool()

cJSON * cJSON_CreateBool ( cJSON_bool boolean)

◆ cJSON_CreateDoubleArray()

cJSON * cJSON_CreateDoubleArray ( const double * numbers,
int count )

◆ cJSON_CreateFalse()

cJSON * cJSON_CreateFalse ( void )

◆ cJSON_CreateFloatArray()

cJSON * cJSON_CreateFloatArray ( const float * numbers,
int count )

◆ cJSON_CreateIntArray()

cJSON * cJSON_CreateIntArray ( const int * numbers,
int count )

◆ cJSON_CreateNull()

cJSON * cJSON_CreateNull ( void )

◆ cJSON_CreateNumber()

cJSON * cJSON_CreateNumber ( double num)

◆ cJSON_CreateObject()

cJSON * cJSON_CreateObject ( void )

◆ cJSON_CreateObjectReference()

cJSON * cJSON_CreateObjectReference ( const cJSON * child)

◆ cJSON_CreateRaw()

cJSON * cJSON_CreateRaw ( const char * raw)

◆ cJSON_CreateString()

cJSON * cJSON_CreateString ( const char * string)

◆ cJSON_CreateStringArray()

cJSON * cJSON_CreateStringArray ( const char *const * strings,
int count )

◆ cJSON_CreateStringReference()

cJSON * cJSON_CreateStringReference ( const char * string)

◆ cJSON_CreateTrue()

cJSON * cJSON_CreateTrue ( void )

◆ cJSON_Delete()

void cJSON_Delete ( cJSON * item)

◆ cJSON_DeleteItemFromArray()

void cJSON_DeleteItemFromArray ( cJSON * array,
int which )

◆ cJSON_DeleteItemFromObject()

void cJSON_DeleteItemFromObject ( cJSON * object,
const char * string )

◆ cJSON_DeleteItemFromObjectCaseSensitive()

void cJSON_DeleteItemFromObjectCaseSensitive ( cJSON * object,
const char * string )

◆ cJSON_DetachItemFromArray()

cJSON * cJSON_DetachItemFromArray ( cJSON * array,
int which )

◆ cJSON_DetachItemFromObject()

cJSON * cJSON_DetachItemFromObject ( cJSON * object,
const char * string )

◆ cJSON_DetachItemFromObjectCaseSensitive()

cJSON * cJSON_DetachItemFromObjectCaseSensitive ( cJSON * object,
const char * string )

◆ cJSON_DetachItemViaPointer()

cJSON * cJSON_DetachItemViaPointer ( cJSON * parent,
cJSON *const item )

◆ cJSON_Duplicate()

cJSON * cJSON_Duplicate ( const cJSON * item,
cJSON_bool recurse )

◆ cJSON_free()

void cJSON_free ( void * object)

◆ cJSON_GetArrayItem()

cJSON * cJSON_GetArrayItem ( const cJSON * array,
int index )

◆ cJSON_GetArraySize()

int cJSON_GetArraySize ( const cJSON * array)

◆ cJSON_GetErrorPtr()

const char * cJSON_GetErrorPtr ( void )

◆ cJSON_GetNumberValue()

double cJSON_GetNumberValue ( cJSON * item)

◆ cJSON_GetObjectItem()

cJSON * cJSON_GetObjectItem ( const cJSON *const object,
const char *const string )

◆ cJSON_GetObjectItemCaseSensitive()

cJSON * cJSON_GetObjectItemCaseSensitive ( const cJSON *const object,
const char *const string )

◆ cJSON_GetStringValue()

char * cJSON_GetStringValue ( cJSON * item)

◆ cJSON_HasObjectItem()

cJSON_bool cJSON_HasObjectItem ( const cJSON * object,
const char * string )

◆ cJSON_InitHooks()

void cJSON_InitHooks ( cJSON_Hooks * hooks)

◆ cJSON_InsertItemInArray()

cJSON_bool cJSON_InsertItemInArray ( cJSON * array,
int which,
cJSON * newitem )

◆ cJSON_IsArray()

cJSON_bool cJSON_IsArray ( const cJSON *const item)

◆ cJSON_IsBool()

cJSON_bool cJSON_IsBool ( const cJSON *const item)

◆ cJSON_IsFalse()

cJSON_bool cJSON_IsFalse ( const cJSON *const item)

◆ cJSON_IsInvalid()

cJSON_bool cJSON_IsInvalid ( const cJSON *const item)

◆ cJSON_IsNull()

cJSON_bool cJSON_IsNull ( const cJSON *const item)

◆ cJSON_IsNumber()

cJSON_bool cJSON_IsNumber ( const cJSON *const item)

◆ cJSON_IsObject()

cJSON_bool cJSON_IsObject ( const cJSON *const item)

◆ cJSON_IsRaw()

cJSON_bool cJSON_IsRaw ( const cJSON *const item)

◆ cJSON_IsString()

cJSON_bool cJSON_IsString ( const cJSON *const item)

◆ cJSON_IsTrue()

cJSON_bool cJSON_IsTrue ( const cJSON *const item)

◆ cJSON_malloc()

void * cJSON_malloc ( size_t size)

◆ cJSON_Minify()

void cJSON_Minify ( char * json)

◆ cJSON_Parse()

cJSON * cJSON_Parse ( const char * value)

◆ cJSON_ParseWithLength()

cJSON * cJSON_ParseWithLength ( const char * value,
size_t buffer_length )

◆ cJSON_ParseWithLengthOpts()

cJSON * cJSON_ParseWithLengthOpts ( const char * value,
size_t buffer_length,
const char ** return_parse_end,
cJSON_bool require_null_terminated )

◆ cJSON_ParseWithOpts()

cJSON * cJSON_ParseWithOpts ( const char * value,
const char ** return_parse_end,
cJSON_bool require_null_terminated )

◆ cJSON_Print()

char * cJSON_Print ( const cJSON * item)

◆ cJSON_PrintBuffered()

char * cJSON_PrintBuffered ( const cJSON * item,
int prebuffer,
cJSON_bool fmt )

◆ cJSON_PrintPreallocated()

cJSON_bool cJSON_PrintPreallocated ( cJSON * item,
char * buffer,
const int length,
const cJSON_bool format )

◆ cJSON_PrintUnformatted()

char * cJSON_PrintUnformatted ( const cJSON * item)

◆ cJSON_ReplaceItemInArray()

cJSON_bool cJSON_ReplaceItemInArray ( cJSON * array,
int which,
cJSON * newitem )

◆ cJSON_ReplaceItemInObject()

cJSON_bool cJSON_ReplaceItemInObject ( cJSON * object,
const char * string,
cJSON * newitem )

◆ cJSON_ReplaceItemInObjectCaseSensitive()

cJSON_bool cJSON_ReplaceItemInObjectCaseSensitive ( cJSON * object,
const char * string,
cJSON * newitem )

◆ cJSON_ReplaceItemViaPointer()

cJSON_bool cJSON_ReplaceItemViaPointer ( cJSON *const parent,
cJSON *const item,
cJSON * replacement )

◆ cJSON_SetNumberHelper()

double cJSON_SetNumberHelper ( cJSON * object,
double number )

◆ cJSON_SetValuestring()

char * cJSON_SetValuestring ( cJSON * object,
const char * valuestring )

◆ cJSON_Version()

const char * cJSON_Version ( void )