- Main
- Tutorials
- Library
- Samples

- File List
- Globals

Data Structures | Macros | Typedefs | Functions | Variables
cJSON.h File Reference
`#include <stddef.h>`

Go to the source code of this file.

## Data Structures
struct | cJSON
struct | cJSON_Hooks

## Macros
#define | CJSON_CDECL
#define | CJSON_STDCALL
#define | CJSON_PUBLIC(type) type
#define | CJSON_VERSION_MAJOR 1
#define | CJSON_VERSION_MINOR 7
#define | CJSON_VERSION_PATCH 11
#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) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
#define | cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
#define | cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)

## Typedefs
typedef struct cJSON | cJSON
typedef struct cJSON_Hooks | cJSON_Hooks
typedef int | cJSON_bool

## Functions
| CJSON_PUBLIC (const char *) cJSON_Version(void)
| CJSON_PUBLIC (void) cJSON_InitHooks(cJSON_Hooks *hooks)
| CJSON_PUBLIC (cJSON *) cJSON_Parse(const char *value)
| CJSON_PUBLIC (char *) cJSON_Print(const cJSON *item)
| CJSON_PUBLIC (cJSON_bool) cJSON_PrintPreallocated(cJSON *item
| CJSON_PUBLIC (double) cJSON_SetNumberHelper(cJSON *object
| CJSON_PUBLIC (void *) cJSON_malloc(size_t size)

## Variables
const char ** | return_parse_end
const char cJSON_bool | require_null_terminated
int | prebuffer
int cJSON_bool | fmt
char * | buffer
char const int | length
char const int const cJSON_bool | format
int | index
const char *const | string
int | count
cJSON * | item
int | which
int cJSON * | newitem
cJSON *const cJSON * | replacement
cJSON_bool | recurse
const cJSON *const | b
const cJSON *const const cJSON_bool | case_sensitive
const char *const | name
const char *const const cJSON_bool | boolean
const char *const const double | number
const char *const const char *const | raw

## Macro Definition Documentation

#define CJSON_CDECL

Definition at line 71 of file cJSON.h.

#define CJSON_STDCALL

Definition at line 72 of file cJSON.h.

#define CJSON_PUBLIC | ( |  | type | ) | type

Definition at line 77 of file cJSON.h.

#define CJSON_VERSION_MAJOR 1

Definition at line 82 of file cJSON.h.

#define CJSON_VERSION_MINOR 7

Definition at line 83 of file cJSON.h.

#define CJSON_VERSION_PATCH 11

Definition at line 84 of file cJSON.h.

#define cJSON_Invalid (0)

Definition at line 89 of file cJSON.h.

#define cJSON_False (1 << 0)

Definition at line 90 of file cJSON.h.

#define cJSON_True (1 << 1)

Definition at line 91 of file cJSON.h.

#define cJSON_NULL (1 << 2)

Definition at line 92 of file cJSON.h.

#define cJSON_Number (1 << 3)

Definition at line 93 of file cJSON.h.

#define cJSON_String (1 << 4)

Definition at line 94 of file cJSON.h.

#define cJSON_Array (1 << 5)

Definition at line 95 of file cJSON.h.

#define cJSON_Object (1 << 6)

Definition at line 96 of file cJSON.h.

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

Definition at line 97 of file cJSON.h.

#define cJSON_IsReference 256

Definition at line 99 of file cJSON.h.

#define cJSON_StringIsConst 512

Definition at line 100 of file cJSON.h.

#define CJSON_NESTING_LIMIT 1000

Definition at line 137 of file cJSON.h.

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

Definition at line 269 of file cJSON.h.

#define cJSON_SetNumberValue | ( |  | object,
|  |  | number
| ) |  | ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))

Definition at line 272 of file cJSON.h.

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

Definition at line 275 of file cJSON.h.

## Typedef Documentation

typedef struct cJSON cJSON

typedef struct cJSON_Hooks cJSON_Hooks

typedef int cJSON_bool

Definition at line 132 of file cJSON.h.

## Function Documentation

CJSON_PUBLIC | ( | const char * |  | ) |

Definition at line 77 of file cJSON.c.

78 {
79 return (const char*) (global_error.json + global_error.position);
80 }
error::json
const unsigned char * json
Definition: cJSON.c:72
error::position
size_t position
Definition: cJSON.c:73

CJSON_PUBLIC | ( | void |  | ) |

CJSON_PUBLIC | ( | cJSON * |  | ) | const

CJSON_PUBLIC | ( | char * |  | ) | const

CJSON_PUBLIC | ( | cJSON_bool |  | ) |

CJSON_PUBLIC | ( | double |  | ) |

CJSON_PUBLIC | ( | void * |  | ) |

Definition at line 2963 of file cJSON.c.

2964 {
2965 return global_hooks.allocate(size);
2966 }
internal_hooks::allocate
void *CJSON_CDECL * allocate(size_t size)

## Variable Documentation

const char** return_parse_end

Definition at line 151 of file cJSON.h.

const char cJSON_bool require_null_terminated

Definition at line 151 of file cJSON.h.

int prebuffer

Definition at line 158 of file cJSON.h.

int cJSON_bool fmt

Definition at line 158 of file cJSON.h.

char* buffer

Definition at line 161 of file cJSON.h.

char const int length

Definition at line 161 of file cJSON.h.

char const int const cJSON_bool format

Definition at line 161 of file cJSON.h.

int index

Definition at line 168 of file cJSON.h.

const char *const const char *const string

Definition at line 170 of file cJSON.h.

int count

Definition at line 212 of file cJSON.h.

cJSON *const item

Definition at line 218 of file cJSON.h.

int which

Definition at line 230 of file cJSON.h.

const char cJSON * newitem

Definition at line 238 of file cJSON.h.

cJSON* const cJSON* replacement

Definition at line 239 of file cJSON.h.

cJSON_bool recurse

Definition at line 245 of file cJSON.h.

const cJSON* const b

Definition at line 251 of file cJSON.h.

const cJSON* const const cJSON_bool case_sensitive

Definition at line 251 of file cJSON.h.

const char *const name

Definition at line 258 of file cJSON.h.

const char* const const cJSON_bool boolean

Definition at line 261 of file cJSON.h.

double number

Definition at line 262 of file cJSON.h.

const char* const const char* const raw

Definition at line 264 of file cJSON.h.