Go to the source code of this file.
|
| c0_json_value * | c0_json_str (const char *s, size_t len) |
| c0_json_value * | c0_json_array (void) |
| c0_json_value * | c0_json_object (void) |
| int | c0_json_array_push (c0_json_value *arr, c0_json_value *item) |
| | takes ownership of item
|
| int | c0_json_object_push (c0_json_value *obj, const char *key, size_t key_len, c0_json_value *val) |
| | copies key, owns val
|
| void | c0_json_free (c0_json_value *v) |
| c0_json_value * | c0_to_value (const uint8_t *buf, size_t len, c0_error *err) |
| | A value tree from C0DATA bytes (the first document's body).
|
| uint8_t * | c0_from_value (const c0_json_value *v, const char *group_name, size_t *out_len) |
| | A value tree as C0DATA compact bytes (malloc'd; caller frees).
|
| c0_json_value * | c0_json_parse (const char *json, size_t len) |
| | Parse JSON text into a value tree (numbers/bools become strings, null the empty string).
|
| char * | c0_json_print (const c0_json_value *v, size_t *out_len) |
| | Serialize a value tree to pretty JSON (2-space indent), NUL-terminated and malloc'd (caller frees).
|
| char * | c0_to_json (const uint8_t *buf, size_t len, size_t *out_len, c0_error *err) |
| | C0DATA bytes → pretty JSON string (malloc'd, NUL-terminated).
|
| uint8_t * | c0_from_json (const char *json, size_t len, const char *group_name, size_t *out_len) |
| | JSON text → C0DATA compact bytes (malloc'd).
|
◆ c0_json_value
| typedef struct c0_json_value c0_json_value |
◆ c0_json_kind
| Enumerator |
|---|
| C0_JSON_STR | |
| C0_JSON_ARRAY | |
| C0_JSON_OBJECT | |
◆ c0_from_json()
| uint8_t * c0_from_json |
( |
const char * | json, |
|
|
size_t | len, |
|
|
const char * | group_name, |
|
|
size_t * | out_len ) |
JSON text → C0DATA compact bytes (malloc'd).
group_name as for c0_from_value. NULL on parse error or allocation failure.
◆ c0_from_value()
| uint8_t * c0_from_value |
( |
const c0_json_value * | v, |
|
|
const char * | group_name, |
|
|
size_t * | out_len ) |
A value tree as C0DATA compact bytes (malloc'd; caller frees).
group_name names the group for data that has none ("data" when NULL). NULL on allocation failure.
◆ c0_json_array()
◆ c0_json_array_push()
◆ c0_json_free()
◆ c0_json_object()
◆ c0_json_object_push()
◆ c0_json_parse()
Parse JSON text into a value tree (numbers/bools become strings, null the empty string).
NULL on parse error or allocation failure.
◆ c0_json_print()
| char * c0_json_print |
( |
const c0_json_value * | v, |
|
|
size_t * | out_len ) |
Serialize a value tree to pretty JSON (2-space indent), NUL-terminated and malloc'd (caller frees).
NULL on allocation failure.
◆ c0_json_str()
◆ c0_to_json()
| char * c0_to_json |
( |
const uint8_t * | buf, |
|
|
size_t | len, |
|
|
size_t * | out_len, |
|
|
c0_error * | err ) |
C0DATA bytes → pretty JSON string (malloc'd, NUL-terminated).
◆ c0_to_value()
A value tree from C0DATA bytes (the first document's body).
NULL on malformed input (detail in *err when given) or allocation failure.