49 #ifndef AOJLS_OBJECT_START_ALLOC_SIZE 50 #define AOJLS_OBJECT_START_ALLOC_SIZE 16 53 #ifndef AOJLS_ARRAY_START_ALLOC_SIZE 54 #define AOJLS_ARRAY_START_ALLOC_SIZE 16 333 bool json_object_get_bool_default(
json_object* o,
char* key,
bool defval);
json_object * json_array_get_object(json_array *a, size_t i)
Returns JSON object in JSON array at position i.
Definition: aojls.c:458
long(* reader_function_t)(char *buffer, size_t len, void *reader_data)
Custom deserialization callback.
Definition: aojls.h:600
json_null * json_make_null(aojls_ctx_t *ctx)
Creates JSON null.
Definition: aojls.c:587
char * json_as_string(json_value_t *value)
Converts reference to string.
Definition: aojls.c:141
writer_function_t writer
Definition: aojls.h:570
bool json_context_error_happened(aojls_ctx_t *ctx)
Whether any error is detected while manipulating with this context or values bound to it...
Definition: aojls.c:607
double json_as_number(json_value_t *value, bool *correct_type)
Converts reference to numeric double value.
Definition: aojls.c:130
bool json_as_bool(json_value_t *value, bool *correct_type)
Converts reference to boolean.
Definition: aojls.c:148
bool json_array_is_null(json_array *a, size_t i)
Returns whether JSON null is at the position i.
Definition: aojls.c:525
json_object * json_object_add(json_object *o, char *key, json_value_t *value)
Adds key-value pair to this JSON object.
Definition: aojls.c:251
char * json_object_get_string(json_object *o, char *key)
Returns string bound to this key.
Definition: aojls.c:356
bool json_is_null(json_value_t *value)
Checks if reference is JSON null.
Definition: aojls.c:159
aojls_ctx_t * json_make_context()
Creates new AOJLS context.
Definition: aojls.c:603
json_array * json_as_array(json_value_t *value)
Converts reference to JSON value to JSON array.
Definition: aojls.c:123
json_value_t * json_context_get_result(aojls_ctx_t *ctx)
Definition: aojls.c:611
size_t offset_per_level
Definition: aojls.h:566
json_array * json_array_get_array(json_array *a, size_t i)
Returns JSON array in JSON array at position i.
Definition: aojls.c:466
double json_array_get_double(json_array *a, size_t i, bool *valid)
Returns double value in JSON array at position i.
Definition: aojls.c:474
void * reader_data
Definition: aojls.h:610
json_value_t * json_object_get_object_as_value(json_object *o, char *key)
Returns JSON value bound to this key.
Definition: aojls.c:308
json_type_t json_get_type(json_value_t *value)
Returns type for provided value.
Definition: aojls.c:110
bool pretty
Definition: aojls.h:565
char * json_array_get_string(json_array *a, size_t i)
Returns string in JSON array at position i.
Definition: aojls.c:492
const char * number_formatter
Definition: aojls.h:568
char * aojls_serialize(json_value_t *value, aojls_serialization_prefs *prefs)
Serializes JSON value.
Definition: aojls.c:877
char * json_object_get_string_default(json_object *o, char *key, char *defval)
Returns string bound to this key or default value.
Definition: aojls.c:364
json_type_t
JSON value tags.
Definition: aojls.h:62
bool json_object_is_null(json_object *o, char *key)
Returns if null is bound for that key.
Definition: aojls.c:389
json_array * json_make_array(aojls_ctx_t *ctx)
Creates new empty JSON array.
Definition: aojls.c:396
json_object * json_as_object(json_value_t *value)
Converts reference to JSON value to JSON object.
Definition: aojls.c:116
aojls_ctx_t * ctx
Definition: aojls.h:612
aojls_ctx_t * aojls_deserialize(char *source, size_t len, aojls_deserialization_prefs *prefs)
Deserialization function.
Definition: aojls.c:1905
bool json_object_get_bool(json_object *o, char *key, bool *valid)
Returns boolean bound to this key.
Definition: aojls.c:371
json_value_t * json_array_get(json_array *a, size_t i)
Returns JSON value at position i.
Definition: aojls.c:450
void * writer_data
Definition: aojls.h:571
bool(* writer_function_t)(const char *buffer, size_t len, void *writer_data)
Custom serialization callback.
Definition: aojls.h:556
json_number * json_from_number(aojls_ctx_t *ctx, double number)
Creates JSON number from number.
Definition: aojls.c:556
json_boolean * json_from_boolean(aojls_ctx_t *ctx, bool b)
Creates JSON boolean from b.
Definition: aojls.c:572
reader_function_t reader
Definition: aojls.h:609
json_object * json_object_nadd(json_object *o, char *key, size_t len, json_value_t *value)
Adds key-value pair to this JSON object.
Definition: aojls.c:257
Serialization preferences.
Definition: aojls.h:564
double json_object_get_double_default(json_object *o, char *key, double defval)
Returns double bound to this key or default value.
Definition: aojls.c:348
size_t json_object_numkeys(json_object *o)
Definition: aojls.c:296
json_array * json_object_get_array(json_object *o, char *key)
Returns JSON array bound to this key.
Definition: aojls.c:330
double json_object_get_double(json_object *o, char *key, bool *valid)
Returns double bound to this key.
Definition: aojls.c:338
bool json_array_get_bool(json_array *a, size_t i, bool *valid)
Returns boolean value in JSON array at position i.
Definition: aojls.c:507
bool json_array_get_bool_default(json_array *a, size_t i, bool defval)
Returns boolean value in JSON array at position i or default value.
Definition: aojls.c:517
json_object * json_make_object(aojls_ctx_t *ctx)
Creates new empty JSON object.
Definition: aojls.c:221
double json_array_get_double_default(json_array *a, size_t i, double defval)
Returns double value in JSON array at position i or default value.
Definition: aojls.c:484
void json_free_context(aojls_ctx_t *ctx)
frees the context and all bound values
Definition: aojls.c:617
json_array * json_array_add(json_array *a, json_value_t *value)
Adds new JSON value to the JSON array.
Definition: aojls.c:419
char * json_object_get_key(json_object *o, size_t i)
Returns key bound to the iteration position i.
Definition: aojls.c:302
bool success
Definition: aojls.h:573
size_t json_array_size(json_array *a)
Returns number of elements in this array.
Definition: aojls.c:444
json_string * json_from_string(aojls_ctx_t *ctx, char *string)
Creates JSON string from string.
Definition: aojls.c:532
const char * error
Definition: aojls.h:613
char * json_array_get_string_default(json_array *a, size_t i, char *defval)
Returns string in JSON array at position i or default.
Definition: aojls.c:500
Deserialization preferences.
Definition: aojls.h:608
json_object * json_object_get_object(json_object *o, char *key)
Returns JSON object bound to this key.
Definition: aojls.c:322
const char * eol
Definition: aojls.h:567