26#ifndef _CRT_SECURE_NO_WARNINGS
27#define _CRT_SECURE_NO_WARNINGS
33#define PARSON_IMPL_VERSION_MAJOR 1
34#define PARSON_IMPL_VERSION_MINOR 5
35#define PARSON_IMPL_VERSION_PATCH 3
37#if (PARSON_VERSION_MAJOR != PARSON_IMPL_VERSION_MAJOR) || \
38 (PARSON_VERSION_MINOR != PARSON_IMPL_VERSION_MINOR) || \
39 (PARSON_VERSION_PATCH != PARSON_IMPL_VERSION_PATCH)
40#error "parson version mismatch between parson.c and parson.h"
52#pragma GCC visibility push(hidden)
59#define sscanf THINK_TWICE_ABOUT_USING_SSCANF
66#define strcpy USE_MEMCPY_INSTEAD_OF_STRCPY
68#define STARTING_CAPACITY 16
69#define MAX_NESTING 2048
71#ifndef PARSON_DEFAULT_FLOAT_FORMAT
72#define PARSON_DEFAULT_FLOAT_FORMAT \
76#ifndef PARSON_NUM_BUF_SIZE
77#define PARSON_NUM_BUF_SIZE \
82#ifndef PARSON_INDENT_STR
83#define PARSON_INDENT_STR " "
86#define SIZEOF_TOKEN(a) (sizeof(a) - 1)
87#define SKIP_CHAR(str) ((*str)++)
88#define SKIP_WHITESPACES(str) \
89 while (isspace((unsigned char)(**str))) { \
92#define MAX(a, b) ((a) > (b) ? (a) : (b))
97#if defined(isnan) && defined(isinf)
98#define IS_NUMBER_INVALID(x) (isnan((x)) || isinf((x)))
100#define IS_NUMBER_INVALID(x) (((x) * 0.0) != 0.0)
103#define OBJECT_INVALID_IX ((size_t)-1)
108static int parson_escape_slashes = 1;
110static char *parson_float_format =
NULL;
116 (((unsigned char)(b) & 0xC0) == 0x80)
121#define PARSON_FALSE 0
129typedef union json_value_value {
144struct json_object_t {
147 unsigned long *hashes;
152 size_t item_capacity;
153 size_t cell_capacity;
164static char *read_file(
const char *filename);
165static void remove_comments(
char *
string,
const char *
start_token,
167static char *parson_strndup(
const char *
string,
size_t n);
168static char *parson_strdup(
const char *
string);
169static int parson_sprintf(
char *s,
const char *format, ...);
170static int hex_char_to_int(
char c);
171static JSON_Status parse_utf16_hex(
const char *
string,
unsigned int *result);
172static int num_bytes_in_utf8_sequence(
unsigned char c);
173static JSON_Status verify_utf8_sequence(
const unsigned char *
string,
int *len);
175static parson_bool_t is_decimal(
const char *
string,
size_t length);
176static unsigned long hash_string(
const char *
string,
size_t n);
184static size_t json_object_get_cell_ix(
const JSON_Object *
object,
185 const char *key,
size_t key_len,
204static void json_array_free(
JSON_Array *array);
207static JSON_Value *json_value_init_string_no_copy(
char *
string,
size_t length);
211static JSON_Status skip_quotes(
const char **
string);
213static char *process_string(
const char *input,
size_t input_len,
218static JSON_Value *parse_string_value(
const char **
string);
219static JSON_Value *parse_boolean_value(
const char **
string);
220static JSON_Value *parse_number_value(
const char **
string);
221static JSON_Value *parse_null_value(
const char **
string);
225static int json_serialize_to_buffer_r(
const JSON_Value *value,
char *buf,
228static int json_serialize_string(
const char *
string,
size_t len,
char *buf);
231static char *read_file(
const char *filename)
265static void remove_comments(
char *
string,
const char *
start_token,
305static char *parson_strndup(
const char *
string,
size_t n)
318static char *parson_strdup(
const char *
string)
320 return parson_strndup(
string,
strlen(
string));
323static int parson_sprintf(
char *s,
const char *format, ...)
329#if defined(__APPLE__) && defined(__clang__)
330#pragma clang diagnostic push
331#pragma clang diagnostic ignored "-Wdeprecated-declarations"
334#if defined(__APPLE__) && defined(__clang__)
335#pragma clang diagnostic pop
342static int hex_char_to_int(
char c)
344 if (c >=
'0' && c <=
'9') {
347 else if (c >=
'a' && c <=
'f') {
350 else if (c >=
'A' && c <=
'F') {
356static JSON_Status parse_utf16_hex(
const char *s,
unsigned int *result)
359 if (s[0] ==
'\0' || s[1] ==
'\0' || s[2] ==
'\0' || s[3] ==
'\0') {
362 x1 = hex_char_to_int(s[0]);
363 x2 = hex_char_to_int(s[1]);
364 x3 = hex_char_to_int(s[2]);
365 x4 = hex_char_to_int(s[3]);
366 if (x1 == -1 || x2 == -1 ||
x3 == -1 ||
x4 == -1) {
369 *result = (
unsigned int)((x1 << 12) | (x2 << 8) | (
x3 << 4) |
x4);
373static int num_bytes_in_utf8_sequence(
unsigned char c)
375 if (c == 0xC0 || c == 0xC1 || c > 0xF4 ||
IS_CONT(c)) {
378 else if ((c & 0x80) == 0) {
381 else if ((c & 0xE0) == 0xC0) {
384 else if ((c & 0xF0) == 0xE0) {
387 else if ((c & 0xF8) == 0xF0) {
393static JSON_Status verify_utf8_sequence(
const unsigned char *
string,
int *len)
396 *len = num_bytes_in_utf8_sequence(
string[0]);
401 else if (*len == 2 &&
IS_CONT(
string[1])) {
402 cp =
string[0] & 0x1F;
403 cp = (
cp << 6) | (
string[1] & 0x3F);
406 cp = ((
unsigned char)
string[0]) & 0xF;
407 cp = (
cp << 6) | (
string[1] & 0x3F);
408 cp = (
cp << 6) | (
string[2] & 0x3F);
412 cp =
string[0] & 0x7;
413 cp = (
cp << 6) | (
string[1] & 0x3F);
414 cp = (
cp << 6) | (
string[2] & 0x3F);
415 cp = (
cp << 6) | (
string[3] & 0x3F);
433 if (
cp >= 0xD800 &&
cp <= 0xDFFF) {
440static int is_valid_utf8(
const char *
string,
size_t string_len)
445 if (verify_utf8_sequence((
const unsigned char *)
string, &len) !=
454static parson_bool_t is_decimal(
const char *
string,
size_t length)
456 if (length > 1 &&
string[0] ==
'0' &&
string[1] !=
'.') {
459 if (length > 2 && !
strncmp(
string,
"-0", 2) &&
string[2] !=
'.') {
463 if (
strchr(
"xX",
string[length])) {
470static unsigned long hash_string(
const char *
string,
size_t n)
472#ifdef PARSON_FORCE_HASH_COLLISIONS
477 unsigned long hash = 5381;
480 for (i = 0; i < n; i++) {
485 hash = ((hash << 5) + hash) + c;
499 new_obj->wrapping_value = wrapping_value;
500 res = json_object_init(
new_obj, 0);
512 object->cells =
NULL;
513 object->names =
NULL;
514 object->values =
NULL;
515 object->cell_ixs =
NULL;
516 object->hashes =
NULL;
519 object->cell_capacity = capacity;
520 object->item_capacity = (
unsigned int)(capacity * 7 / 10);
527 (
size_t *)parson_malloc(object->cell_capacity *
sizeof(*object->cells));
529 (
char **)parson_malloc(object->item_capacity *
sizeof(*object->names));
530 object->values = (
JSON_Value **)parson_malloc(object->item_capacity *
531 sizeof(*object->values));
532 object->cell_ixs = (
size_t *)parson_malloc(object->item_capacity *
533 sizeof(*object->cell_ixs));
534 object->hashes = (
unsigned long *)parson_malloc(object->item_capacity *
535 sizeof(*object->hashes));
536 if (object->cells ==
NULL || object->names ==
NULL ||
537 object->values ==
NULL || object->cell_ixs ==
NULL ||
538 object->hashes ==
NULL) {
541 for (i = 0; i <
object->cell_capacity; i++) {
546 parson_free(object->cells);
547 parson_free(object->names);
548 parson_free(object->values);
549 parson_free(object->cell_ixs);
550 parson_free(object->hashes);
558 for (i = 0; i <
object->count; i++) {
560 parson_free(object->names[i]);
568 object->item_capacity = 0;
569 object->cell_capacity = 0;
571 parson_free(object->cells);
572 parson_free(object->names);
573 parson_free(object->values);
574 parson_free(object->cell_ixs);
575 parson_free(object->hashes);
577 object->cells =
NULL;
578 object->names =
NULL;
579 object->values =
NULL;
580 object->cell_ixs =
NULL;
581 object->hashes =
NULL;
600 for (i = 0; i <
object->count; i++) {
601 key =
object->names[i];
602 value =
object->values[i];
603 res = json_object_add(&
new_object, key, value);
608 value->parent = wrapping_value;
615static size_t json_object_get_cell_ix(
const JSON_Object *
object,
616 const char *key,
size_t key_len,
620 size_t cell_ix = hash & (
object->cell_capacity - 1);
630 for (i = 0; i <
object->cell_capacity; i++) {
631 ix = (
cell_ix + i) & (object->cell_capacity - 1);
632 cell =
object->cells[
ix];
654 unsigned long hash = 0;
659 if (!
object || !
name || !value) {
670 if (object->count >= object->item_capacity) {
671 res = json_object_grow_and_rehash(
object);
679 object->names[
object->count] =
name;
680 object->cells[
cell_ix] =
object->count;
681 object->values[
object->count] = value;
682 object->cell_ixs[
object->count] =
cell_ix;
683 object->hashes[
object->count] = hash;
693 unsigned long hash = 0;
697 if (!
object || !
name) {
707 return object->values[
item_ix];
714 unsigned long hash = 0;
725 if (
object ==
NULL) {
743 parson_free(object->names[
item_ix]);
756 for (x = 0;
x < (
object->cell_capacity - 1);
x++) {
757 j = (
j + 1) & (object->cell_capacity - 1);
761 k =
object->hashes[
object->cells[
j]] & (
object->cell_capacity - 1);
763 object->cell_ixs[
object->cells[
j]] = i;
764 object->cells[i] =
object->cells[
j];
803 new_array->wrapping_value = wrapping_value;
812 if (array->count >= array->capacity) {
819 array->items[array->count] = value;
835 if (array->items !=
NULL && array->count > 0) {
838 parson_free(array->items);
847 for (i = 0; i < array->count; i++) {
850 parson_free(array->items);
855static JSON_Value *json_value_init_string_no_copy(
char *
string,
size_t length)
871 if (**
string !=
'\"') {
875 while (**
string !=
'\"') {
876 if (**
string ==
'\0') {
879 else if (**
string ==
'\\') {
881 if (**
string ==
'\0') {
905 else if (
cp < 0x800) {
916 else if (
cp >= 0xD800 &&
929 cp = ((((
lead - 0xD800) & 0x3FF) << 10) | ((
trail - 0xDC00) & 0x3FF)) +
948static char *process_string(
const char *input,
size_t input_len,
997 else if ((
unsigned char)*
input_ptr < 0x20) {
1047 return parse_object_value(
string,
nesting + 1);
1049 return parse_array_value(
string,
nesting + 1);
1051 return parse_string_value(
string);
1054 return parse_boolean_value(
string);
1066 return parse_number_value(
string);
1068 return parse_null_value(
string);
1085 if (**
string !=
'{') {
1092 if (**
string ==
'}') {
1096 while (**
string !=
'\0') {
1110 if (**
string !=
':') {
1130 if (**
string !=
',') {
1135 if (**
string ==
'}') {
1140 if (**
string !=
'}') {
1156 if (**
string !=
'[') {
1163 if (**
string ==
']') {
1167 while (**
string !=
'\0') {
1179 if (**
string !=
',') {
1184 if (**
string ==
']') {
1189 if (**
string !=
']' ||
1199static JSON_Value *parse_string_value(
const char **
string)
1208 if (value ==
NULL) {
1215static JSON_Value *parse_boolean_value(
const char **
string)
1230static JSON_Value *parse_number_value(
const char **
string)
1235 number =
strtod(*
string, &end);
1246static JSON_Value *parse_null_value(
const char **
string)
1263#define APPEND_STRING(str) \
1265 written = SIZEOF_TOKEN((str)); \
1266 if (buf != NULL) { \
1267 memcpy(buf, (str), written); \
1268 buf[written] = '\0'; \
1271 written_total += written; \
1274#define APPEND_INDENT(level) \
1277 for (level_i = 0; level_i < (level); level_i++) { \
1278 APPEND_STRING(PARSON_INDENT_STR); \
1282static int json_serialize_to_buffer_r(
const JSON_Value *value,
char *buf,
1286 const char *key =
NULL, *
string =
NULL;
1290 size_t i = 0,
count = 0;
1303 for (i = 0; i <
count; i++) {
1317 if (i < (
count - 1)) {
1336 for (i = 0; i <
count; i++) {
1367 if (i < (
count - 1)) {
1381 if (
string ==
NULL) {
1385 written = json_serialize_string(
string, len, buf);
1407 if (parson_number_serialization_function) {
1412 ? parson_float_format
1434static int json_serialize_string(
const char *
string,
size_t len,
char *buf)
1440 for (i = 0; i < len; i++) {
1551 if (parson_escape_slashes) {
1601 if (
string ==
NULL) {
1604 if (
string[0] ==
'\xEF' &&
string[1] ==
'\xBB' &&
string[2] ==
'\xBF') {
1605 string =
string + 3;
1607 return parse_value((
const char **)&
string, 0);
1714 return object ?
object->count : 0;
1722 return object->names[index];
1730 return object->values[index];
1738 return object->wrapping_value;
1771 return array->items[index];
1806 return array ? array->count : 0;
1814 return array->wrapping_value;
1842 const JSON_String *str = json_value_get_string_desc(value);
1843 return str ? str->chars :
NULL;
1848 const JSON_String *str = json_value_get_string_desc(value);
1849 return str ? str->length : 0;
1865 return value ? value->parent :
NULL;
1872 json_object_free(value->value.object);
1875 parson_free(value->value.string.chars);
1878 json_array_free(value->value.array);
1920 if (
string ==
NULL) {
1930 if (
string ==
NULL) {
1933 if (!is_valid_utf8(
string, length)) {
1936 copy = parson_strndup(
string, length);
1940 value = json_value_init_string_no_copy(
copy, length);
1941 if (value ==
NULL) {
1971 new_value->value.boolean =
boolean ? 1 : 0;
2087 return res < 0 ? 0 : (
size_t)(res) + 1;
2106 const char *filename)
2114 fp =
fopen(filename,
"w");
2155 return res < 0 ? 0 : (
size_t)(res) + 1;
2174 const char *filename)
2182 fp =
fopen(filename,
"w");
2220 parson_free(
string);
2240 if (array ==
NULL || value ==
NULL || value->parent !=
NULL ||
2246 array->items[
ix] = value;
2254 if (value ==
NULL) {
2265 const char *
string,
size_t len)
2268 if (value ==
NULL) {
2282 if (value ==
NULL) {
2295 if (value ==
NULL) {
2308 if (value ==
NULL) {
2321 if (array ==
NULL) {
2333 if (array ==
NULL || value ==
NULL || value->parent !=
NULL) {
2336 return json_array_add(array, value);
2342 if (value ==
NULL) {
2353 const char *
string,
size_t len)
2356 if (value ==
NULL) {
2369 if (value ==
NULL) {
2382 if (value ==
NULL) {
2395 if (value ==
NULL) {
2408 unsigned long hash = 0;
2415 if (!
object || !
name || !value || value->parent) {
2425 object->values[
item_ix] = value;
2429 if (object->count >= object->item_capacity) {
2430 JSON_Status res = json_object_grow_and_rehash(
object);
2441 object->names[
object->count] =
key_copy;
2442 object->cells[
cell_ix] =
object->count;
2443 object->values[
object->count] = value;
2444 object->cell_ixs[
object->count] =
cell_ix;
2445 object->hashes[
object->count] = hash;
2464 const char *
string,
size_t len)
2564 if (value ==
NULL) {
2576 const char *
string,
size_t len)
2579 if (value ==
NULL) {
2593 if (value ==
NULL) {
2607 if (value ==
NULL) {
2620 if (value ==
NULL) {
2643 if (
object ==
NULL) {
2647 parson_free(object->names[i]);
2648 object->names[i] =
NULL;
2651 object->values[i] =
NULL;
2654 for (i = 0; i <
object->cell_capacity; i++) {
2666 const char *key =
NULL;
2667 size_t i = 0,
count = 0;
2705 for (i = 0; i <
count; i++) {
2733 const char *key =
NULL;
2750 for (i = 0; i <
a_count; i++) {
2765 for (i = 0; i <
a_count; i++) {
2774 a_string = json_value_get_string_desc(a);
2775 b_string = json_value_get_string_desc(
b);
2844 if (parson_float_format) {
2845 parson_free(parson_float_format);
2846 parson_float_format =
NULL;
2849 parson_float_format =
NULL;
2852 parson_float_format = parson_strdup(format);
2858 parson_number_serialization_function = func;
2861#if defined(__GNUC__)
2862#pragma GCC visibility pop
#define HUGE_VAL
Values needed for Ray-Convex Polyhedron Intersection Test below originally by Eric Haines,...
JSON_Status json_object_dotset_string(JSON_Object *object, const char *name, const char *string)
size_t json_object_get_string_len(const JSON_Object *object, const char *name)
JSON_Status json_array_replace_null(JSON_Array *array, size_t i)
const char * json_value_get_string(const JSON_Value *value)
const char * json_string(const JSON_Value *value)
int json_object_get_boolean(const JSON_Object *object, const char *name)
size_t json_value_get_string_len(const JSON_Value *value)
size_t json_string_len(const JSON_Value *value)
JSON_Status json_object_dotset_boolean(JSON_Object *object, const char *name, int boolean)
JSON_Status json_array_append_null(JSON_Array *array)
JSON_Status json_array_replace_boolean(JSON_Array *array, size_t i, int boolean)
JSON_Status json_object_remove(JSON_Object *object, const char *name)
JSON_Status json_serialize_to_buffer_pretty(const JSON_Value *value, char *buf, size_t buf_size_in_bytes)
#define IS_NUMBER_INVALID(x)
size_t json_serialization_size_pretty(const JSON_Value *value)
JSON_Status json_array_replace_value(JSON_Array *array, size_t ix, JSON_Value *value)
JSON_Value * json_array_get_value(const JSON_Array *array, size_t index)
const char * json_array_get_string(const JSON_Array *array, size_t index)
JSON_Status json_array_append_boolean(JSON_Array *array, int boolean)
JSON_Value_Type json_type(const JSON_Value *value)
int json_object_dotget_boolean(const JSON_Object *object, const char *name)
const char * json_object_get_name(const JSON_Object *object, size_t index)
JSON_Status json_array_replace_string_with_len(JSON_Array *array, size_t i, const char *string, size_t len)
JSON_Array * json_value_get_array(const JSON_Value *value)
const char * json_object_dotget_string(const JSON_Object *object, const char *name)
JSON_Status json_object_dotset_null(JSON_Object *object, const char *name)
JSON_Status json_object_set_string_with_len(JSON_Object *object, const char *name, const char *string, size_t len)
struct json_string JSON_String
#define SKIP_WHITESPACES(str)
JSON_Status json_object_set_number(JSON_Object *object, const char *name, double number)
int json_object_has_value_of_type(const JSON_Object *object, const char *name, JSON_Value_Type type)
JSON_Object * json_object_get_object(const JSON_Object *object, const char *name)
void json_set_float_serialization_format(const char *format)
size_t json_array_get_count(const JSON_Array *array)
double json_array_get_number(const JSON_Array *array, size_t index)
JSON_Status json_array_replace_number(JSON_Array *array, size_t i, double number)
JSON_Value * json_object_dotget_value(const JSON_Object *object, const char *name)
void json_set_number_serialization_function(JSON_Number_Serialization_Function func)
JSON_Status json_array_clear(JSON_Array *array)
JSON_Status json_object_set_string(JSON_Object *object, const char *name, const char *string)
JSON_Status json_object_set_boolean(JSON_Object *object, const char *name, int boolean)
void json_free_serialized_string(char *string)
JSON_Status json_array_remove(JSON_Array *array, size_t ix)
int json_value_equals(const JSON_Value *a, const JSON_Value *b)
union json_value_value JSON_Value_Value
JSON_Status json_validate(const JSON_Value *schema, const JSON_Value *value)
JSON_Status json_serialize_to_file(const JSON_Value *value, const char *filename)
JSON_Status json_array_append_string_with_len(JSON_Array *array, const char *string, size_t len)
#define PARSON_DEFAULT_FLOAT_FORMAT
JSON_Array * json_object_dotget_array(const JSON_Object *object, const char *name)
int json_object_dothas_value_of_type(const JSON_Object *object, const char *name, JSON_Value_Type type)
void json_set_escape_slashes(int escape_slashes)
JSON_Status json_object_dotremove(JSON_Object *object, const char *name)
JSON_Status json_object_dotset_value(JSON_Object *object, const char *name, JSON_Value *value)
JSON_Value * json_value_init_array(void)
size_t json_object_get_count(const JSON_Object *object)
#define STARTING_CAPACITY
JSON_Value * json_object_get_wrapping_value(const JSON_Object *object)
JSON_Object * json_array_get_object(const JSON_Array *array, size_t index)
int json_boolean(const JSON_Value *value)
double json_number(const JSON_Value *value)
JSON_Object * json_object_dotget_object(const JSON_Object *object, const char *name)
JSON_Value * json_object_get_value_at(const JSON_Object *object, size_t index)
JSON_Value * json_parse_string(const char *string)
JSON_Status json_array_append_value(JSON_Array *array, JSON_Value *value)
int json_object_dothas_value(const JSON_Object *object, const char *name)
#define APPEND_INDENT(level)
JSON_Value * json_value_init_number(double number)
#define PARSON_NUM_BUF_SIZE
JSON_Array * json_array(const JSON_Value *value)
JSON_Array * json_object_get_array(const JSON_Object *object, const char *name)
int json_object_has_value(const JSON_Object *object, const char *name)
int json_value_get_boolean(const JSON_Value *value)
JSON_Value * json_value_deep_copy(const JSON_Value *value)
JSON_Value * json_parse_string_with_comments(const char *string)
JSON_Value * json_object_get_value(const JSON_Object *object, const char *name)
JSON_Status json_object_clear(JSON_Object *object)
const char * json_object_get_string(const JSON_Object *object, const char *name)
int json_array_get_boolean(const JSON_Array *array, size_t index)
char * json_serialize_to_string(const JSON_Value *value)
JSON_Status json_object_set_value(JSON_Object *object, const char *name, JSON_Value *value)
JSON_Status json_object_dotset_string_with_len(JSON_Object *object, const char *name, const char *string, size_t len)
JSON_Value * json_value_init_null(void)
JSON_Value * json_array_get_wrapping_value(const JSON_Array *array)
size_t json_array_get_string_len(const JSON_Array *array, size_t index)
void json_value_free(JSON_Value *value)
JSON_Status json_object_set_null(JSON_Object *object, const char *name)
JSON_Status json_serialize_to_file_pretty(const JSON_Value *value, const char *filename)
JSON_Value * json_parse_file(const char *filename)
size_t json_serialization_size(const JSON_Value *value)
#define APPEND_STRING(str)
JSON_Status json_array_append_string(JSON_Array *array, const char *string)
JSON_Array * json_array_get_array(const JSON_Array *array, size_t index)
JSON_Value * json_value_init_string_with_len(const char *string, size_t length)
size_t json_object_dotget_string_len(const JSON_Object *object, const char *name)
JSON_Value * json_value_init_boolean(int boolean)
double json_value_get_number(const JSON_Value *value)
double json_object_get_number(const JSON_Object *object, const char *name)
double json_object_dotget_number(const JSON_Object *object, const char *name)
JSON_Value_Type json_value_get_type(const JSON_Value *value)
JSON_Object * json_value_get_object(const JSON_Value *value)
JSON_Object * json_object(const JSON_Value *value)
JSON_Value * json_value_init_object(void)
char * json_serialize_to_string_pretty(const JSON_Value *value)
JSON_Value * json_value_init_string(const char *string)
JSON_Status json_object_dotset_number(JSON_Object *object, const char *name, double number)
#define OBJECT_INVALID_IX
void json_set_allocation_functions(JSON_Malloc_Function malloc_fun, JSON_Free_Function free_fun)
JSON_Value * json_parse_file_with_comments(const char *filename)
JSON_Status json_array_append_number(JSON_Array *array, double number)
JSON_Status json_array_replace_string(JSON_Array *array, size_t i, const char *string)
JSON_Value * json_value_get_parent(const JSON_Value *value)
JSON_Status json_serialize_to_buffer(const JSON_Value *value, char *buf, size_t buf_size_in_bytes)
int(* JSON_Number_Serialization_Function)(double num, char *buf)
struct json_array_t JSON_Array
struct json_value_t JSON_Value
void(* JSON_Free_Function)(void *)
struct json_object_t JSON_Object
void *(* JSON_Malloc_Function)(size_t)
void output(const char *fmt,...)