Types

JSON data types. More...

Data Structures

struct  json_tok_t
 Parse JSON token. More...
 
struct  json_parse_config_t
 JSON parser configuration. More...
 

Typedefs

typedef void * json_parse_context_t
 Context of JSON parsing.
 
typedef zos_result_t(* json_parse_reader_t) (void *user, void *data, uint32_t max_length, uint32_t *bytes_read)
 Reader callback. More...
 
typedef zos_result_t(* json_token_callback_t) (void *user, json_parse_context_t *context, json_tok_t *tok)
 Allocate token callback. More...
 

Enumerations

enum  json_type_t {
  JSON_TYPE_ARRAY,
  JSON_TYPE_OBJECT,
  JSON_TYPE_STRING,
  JSON_TYPE_BOOLEAN,
  JSON_TYPE_INTEGER,
  JSON_TYPE_INTEGER64,
  JSON_TYPE_FLOAT,
  JSON_TYPE_NULL
}
 JSON token type. More...
 

Detailed Description

JSON data types.

Typedef Documentation

typedef zos_result_t(* json_parse_reader_t) (void *user, void *data, uint32_t max_length, uint32_t *bytes_read)

Reader callback.

This is an optional callback that is called to read more JSON formatted data.

If there is no more data to be read, set bytes_read to 0 which tells the parser to stop calling this callback.

Parameters
userOptional pointer to user data, passed to json_parse_chunked(), leave NULL if unused
dataBuffer to hold read data
max_lengthLength of given buffer
bytes_readNumber of bytes actually read, set to 0 if no more data available
Returns
zos_result_t result of api call
typedef zos_result_t(* json_token_callback_t) (void *user, json_parse_context_t *context, json_tok_t *tok)

Allocate token callback.

This is called before every token is allocated. This callback should return ZOS_SUCCESS if the token should be allocated, ZOS_ABORTED if the token should NOT be allocated, anything else will cause the parser to fail.

Parameters
userOptional pointer to user data, passed to json_parse_chunked(), leave NULL if unused
contextParser context pointer
tokThe token that may be allocated
Returns
ZOS_SUCCESS if token should be allocated, ZOS_ABORTED if token should NOT be allocated, anything else is a failure

Enumeration Type Documentation

JSON token type.

See this tutorial for more info.

Enumerator
JSON_TYPE_ARRAY 

an ordered sequence of values

JSON_TYPE_OBJECT 

an unordered collection of key:value pairs

JSON_TYPE_STRING 

double-quoted Unicode with backslash escaping

JSON_TYPE_BOOLEAN 

true or false

JSON_TYPE_INTEGER 

32bit integer

JSON_TYPE_INTEGER64 

64bit integer

JSON_TYPE_FLOAT 

floating point number (returned as a string)

JSON_TYPE_NULL 

empty