1 #ifndef __SIMPLE_JSON_H__ 2 #define __SIMPLE_JSON_H__ int sj_is_object(SJson *json)
check if the json is an object
SJson * sj_array_new()
allocate a new empty json array
SJson * sj_new_str(char *str)
make a new json value that is a string
SJson * sj_load(const char *filename)
loads and parses a json file
int sj_get_bool_value(SJson *json, short int *b)
get the json value as a bool Can be used to check for existence
this is the abstract container structure for all json data This structure may be an object...
void sj_array_append(SJson *array, SJson *value)
append to a JSON array a new value
SJson * sj_array_get_nth(SJson *array, int n)
retrieve the nth element in the json array
SJson * sj_new_float(float f)
make a new json value that is a float
void sj_echo(SJson *json)
print the contents of the json file to stdout
const char * sj_get_string_value(SJson *json)
get the JSON value as a string
void sj_free(SJson *sjs)
frees a previously loaded json struct
int sj_array_get_count(SJson *array)
get the number of elements in the json array
int sj_is_array(SJson *json)
check if the json is an array
int sj_get_float_value(SJson *json, float *f)
get the json value as a float Can be used to check for existence
SJson * sj_object_get_value(SJson *object, char *key)
get the json value from an object given a key
int sj_is_string(SJson *json)
check if the json is a string
int sj_is_null(SJson *json)
check if the json is NULL
void sj_object_insert(SJson *object, char *key, SJson *value)
insert data into a json object
SJson * sj_null_new()
make a new json value that is NULL
SJson * sj_object_new()
allocate a new empty json object
int sj_is_bool(SJson *json)
check if the json is a bool
int sj_is_number(SJson *json)
check if the json is a number
SJson * sj_new_bool(int b)
make a new json value that is a bool
SJson * sj_new_int(int i)
make a new json value that is an integer
void sj_save(SJson *json, char *filename)
write a json value as a formatted json string to file
SJson * sj_copy(SJson *json)
make a duplicate of a json structure.
int sj_get_integer_value(SJson *json, int *i)
get the json value as an integer Can be used to check for existence