htils 1
A small set of utilities for C programming.
Loading...
Searching...
No Matches
json.h File Reference
#include <h2o/memory.h>
#include <htils/basictypes.h>
#include <h2otils/string.h>
#include <h2otils/stringmap.h>

Go to the source code of this file.

Data Structures

struct  h2o_json_node
 
struct  h2o_json_error
 

Typedefs

typedef enum h2o_json_type h2o_json_type_t
 
typedef enum h2o_json_parse_method h2o_json_parse_method_t
 
typedef struct h2o_json_node h2o_json_node_t
 
typedef enum h2o_json_write_options h2o_json_write_options_t
 
typedef struct h2o_json_error h2o_json_error_t
 

Enumerations

enum  h2o_json_type {
  H2O_JSON_NULL , H2O_JSON_BOOL , H2O_JSON_FLOAT , H2O_JSON_INTEGER ,
  H2O_JSON_STRING , H2O_JSON_ARRAY , H2O_JSON_OBJECT , H2O_JSON_INVALID
}
 
enum  h2o_json_parse_method { H2O_JSON_PARSE_FULL , H2O_JSON_PARSE_LAZY }
 
enum  h2o_json_write_options { H2O_JSON_WRITE_DEFAULT = 0 , H2O_JSON_WRITE_PRETTY = 1 << 0 , H2O_JSON_WRITE_SORT_KEYS = 1 << 1 , H2O_JSON_WRITE_COMPACT = 1 << 2 }
 

Functions

h2o_json_node_th2o_json_parse (h2o_mem_pool_t *pool, const h2o_string *json_body)
 
h2o_json_node_th2o_json_parse_from_slice (h2o_mem_pool_t *pool, const h2o_string_slice slice)
 
h2o_json_node_th2o_json_parse_from_lazy_slice (h2o_mem_pool_t *pool, h2o_string_slice slice)
 
h2o_json_node_th2o_json_get_object (h2o_mem_pool_t *pool, h2o_json_node_t *obj, h2o_string *key)
 
h2o_json_node_th2o_json_get_object_slice (h2o_mem_pool_t *pool, h2o_json_node_t *obj, h2o_string_slice slice)
 
h2o_json_node_th2o_json_get_array (h2o_mem_pool_t *pool, h2o_json_node_t *arr, u64 idx)
 
h2o_json_node_th2o_json_path_get (h2o_mem_pool_t *pool, const h2o_string *json_string, const h2o_string *path)
 
h2o_json_node_th2o_json_path_get_slice (h2o_mem_pool_t *pool, const h2o_string_slice json_slice, const h2o_string_slice path)
 
b32 h2o_json_is_valid (h2o_json_node_t *node)
 
b32 h2o_json_is_array (h2o_json_node_t *node)
 
b32 h2o_json_is_object (h2o_json_node_t *node)
 
b32 h2o_json_is_string (h2o_json_node_t *node)
 
b32 h2o_json_is_integer (h2o_json_node_t *node)
 
b32 h2o_json_is_float (h2o_json_node_t *node)
 
b32 h2o_json_is_bool (h2o_json_node_t *node)
 
b32 h2o_json_is_null (h2o_json_node_t *node)
 
b32 h2o_json_get_bool (h2o_json_node_t *node)
 
i64 h2o_json_get_integer (h2o_json_node_t *node)
 
f64 h2o_json_get_float (h2o_json_node_t *node)
 
h2o_string_slice h2o_json_get_string (h2o_json_node_t *node)
 
u64 h2o_json_get_array_count (h2o_json_node_t *node)
 
h2o_stringh2o_json_write (h2o_mem_pool_t *pool, h2o_json_node_t *node, h2o_json_write_options_t options, u64 indent)
 
h2o_stringh2o_json_write_pretty (h2o_mem_pool_t *pool, h2o_json_node_t *node, u64 indent)
 
h2o_json_node_th2o_json_new_null (h2o_mem_pool_t *pool)
 
h2o_json_node_th2o_json_new_bool (h2o_mem_pool_t *pool, b32 val)
 
h2o_json_node_th2o_json_new_integer (h2o_mem_pool_t *pool, i64 val)
 
h2o_json_node_th2o_json_new_float (h2o_mem_pool_t *pool, f64 val)
 
h2o_json_node_th2o_json_new_string (h2o_mem_pool_t *pool, h2o_string *val)
 
h2o_json_node_th2o_json_new_string_slice (h2o_mem_pool_t *pool, h2o_string_slice val)
 
h2o_json_node_th2o_json_new_array (h2o_mem_pool_t *pool)
 
h2o_json_node_th2o_json_new_object (h2o_mem_pool_t *pool)
 
b32 h2o_json_array_push (h2o_mem_pool_t *pool, h2o_json_node_t *arr, h2o_json_node_t *val)
 
b32 h2o_json_array_set (h2o_mem_pool_t *pool, h2o_json_node_t *arr, h2o_json_node_t *val, u64 idx)
 
b32 h2o_json_obj_set (h2o_mem_pool_t *pool, h2o_json_node_t *obj, h2o_string *key, h2o_json_node_t *val)
 
h2o_json_error_th2o_json_get_error (h2o_mem_pool_t *pool)
 
void h2o_json_clear_error (void)
 

Typedef Documentation

◆ h2o_json_error_t

◆ h2o_json_node_t

◆ h2o_json_parse_method_t

◆ h2o_json_type_t

◆ h2o_json_write_options_t

Enumeration Type Documentation

◆ h2o_json_parse_method

Enumerator
H2O_JSON_PARSE_FULL 
H2O_JSON_PARSE_LAZY 

◆ h2o_json_type

Enumerator
H2O_JSON_NULL 
H2O_JSON_BOOL 
H2O_JSON_FLOAT 
H2O_JSON_INTEGER 
H2O_JSON_STRING 
H2O_JSON_ARRAY 
H2O_JSON_OBJECT 
H2O_JSON_INVALID 

◆ h2o_json_write_options

Enumerator
H2O_JSON_WRITE_DEFAULT 
H2O_JSON_WRITE_PRETTY 
H2O_JSON_WRITE_SORT_KEYS 
H2O_JSON_WRITE_COMPACT 

Function Documentation

◆ h2o_json_array_push()

b32 h2o_json_array_push ( h2o_mem_pool_t *  pool,
h2o_json_node_t arr,
h2o_json_node_t val 
)

◆ h2o_json_array_set()

b32 h2o_json_array_set ( h2o_mem_pool_t *  pool,
h2o_json_node_t arr,
h2o_json_node_t val,
u64  idx 
)

◆ h2o_json_clear_error()

void h2o_json_clear_error ( void  )

◆ h2o_json_get_array()

h2o_json_node_t * h2o_json_get_array ( h2o_mem_pool_t *  pool,
h2o_json_node_t arr,
u64  idx 
)

◆ h2o_json_get_array_count()

u64 h2o_json_get_array_count ( h2o_json_node_t node)

◆ h2o_json_get_bool()

b32 h2o_json_get_bool ( h2o_json_node_t node)

◆ h2o_json_get_error()

h2o_json_error_t * h2o_json_get_error ( h2o_mem_pool_t *  pool)

◆ h2o_json_get_float()

f64 h2o_json_get_float ( h2o_json_node_t node)

◆ h2o_json_get_integer()

i64 h2o_json_get_integer ( h2o_json_node_t node)

◆ h2o_json_get_object()

h2o_json_node_t * h2o_json_get_object ( h2o_mem_pool_t *  pool,
h2o_json_node_t obj,
h2o_string key 
)

◆ h2o_json_get_object_slice()

h2o_json_node_t * h2o_json_get_object_slice ( h2o_mem_pool_t *  pool,
h2o_json_node_t obj,
h2o_string_slice  slice 
)

◆ h2o_json_get_string()

h2o_string_slice h2o_json_get_string ( h2o_json_node_t node)

◆ h2o_json_is_array()

b32 h2o_json_is_array ( h2o_json_node_t node)

◆ h2o_json_is_bool()

b32 h2o_json_is_bool ( h2o_json_node_t node)

◆ h2o_json_is_float()

b32 h2o_json_is_float ( h2o_json_node_t node)

◆ h2o_json_is_integer()

b32 h2o_json_is_integer ( h2o_json_node_t node)

◆ h2o_json_is_null()

b32 h2o_json_is_null ( h2o_json_node_t node)

◆ h2o_json_is_object()

b32 h2o_json_is_object ( h2o_json_node_t node)

◆ h2o_json_is_string()

b32 h2o_json_is_string ( h2o_json_node_t node)

◆ h2o_json_is_valid()

b32 h2o_json_is_valid ( h2o_json_node_t node)

◆ h2o_json_new_array()

h2o_json_node_t * h2o_json_new_array ( h2o_mem_pool_t *  pool)

◆ h2o_json_new_bool()

h2o_json_node_t * h2o_json_new_bool ( h2o_mem_pool_t *  pool,
b32  val 
)

◆ h2o_json_new_float()

h2o_json_node_t * h2o_json_new_float ( h2o_mem_pool_t *  pool,
f64  val 
)

◆ h2o_json_new_integer()

h2o_json_node_t * h2o_json_new_integer ( h2o_mem_pool_t *  pool,
i64  val 
)

◆ h2o_json_new_null()

h2o_json_node_t * h2o_json_new_null ( h2o_mem_pool_t *  pool)

◆ h2o_json_new_object()

h2o_json_node_t * h2o_json_new_object ( h2o_mem_pool_t *  pool)

◆ h2o_json_new_string()

h2o_json_node_t * h2o_json_new_string ( h2o_mem_pool_t *  pool,
h2o_string val 
)

◆ h2o_json_new_string_slice()

h2o_json_node_t * h2o_json_new_string_slice ( h2o_mem_pool_t *  pool,
h2o_string_slice  val 
)

◆ h2o_json_obj_set()

b32 h2o_json_obj_set ( h2o_mem_pool_t *  pool,
h2o_json_node_t obj,
h2o_string key,
h2o_json_node_t val 
)

◆ h2o_json_parse()

h2o_json_node_t * h2o_json_parse ( h2o_mem_pool_t *  pool,
const h2o_string json_body 
)

◆ h2o_json_parse_from_lazy_slice()

h2o_json_node_t * h2o_json_parse_from_lazy_slice ( h2o_mem_pool_t *  pool,
h2o_string_slice  slice 
)

◆ h2o_json_parse_from_slice()

h2o_json_node_t * h2o_json_parse_from_slice ( h2o_mem_pool_t *  pool,
const h2o_string_slice  slice 
)

◆ h2o_json_path_get()

h2o_json_node_t * h2o_json_path_get ( h2o_mem_pool_t *  pool,
const h2o_string json_string,
const h2o_string path 
)

◆ h2o_json_path_get_slice()

h2o_json_node_t * h2o_json_path_get_slice ( h2o_mem_pool_t *  pool,
const h2o_string_slice  json_slice,
const h2o_string_slice  path 
)

◆ h2o_json_write()

h2o_string * h2o_json_write ( h2o_mem_pool_t *  pool,
h2o_json_node_t node,
h2o_json_write_options_t  options,
u64  indent 
)

◆ h2o_json_write_pretty()

h2o_string * h2o_json_write_pretty ( h2o_mem_pool_t *  pool,
h2o_json_node_t node,
u64  indent 
)