Simple JSON  0.1
A free simple json library for C
simple_json_array.h File Reference
Include dependency graph for simple_json_array.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

SJsonsj_array_new ()
 allocate a new empty json array More...
 
void sj_array_free (SJson *array)
 
void sj_array_append (SJson *array, SJson *value)
 append to a JSON array a new value More...
 
SJsonsj_array_get_nth (SJson *array, int n)
 retrieve the nth element in the json array More...
 
SJStringsj_array_get_nth_as_string (SJson *array, int n)
 retrieve the nth element in the json array assumed to be a string More...
 
SJStringsj_array_to_json_string (SJson *array)
 get the contents of the array as a formatted json string for output More...
 

Function Documentation

void sj_array_append ( SJson array,
SJson value 
)

append to a JSON array a new value

Parameters
arraythe JSON array to append to
valuethe value to add to the string
Note
: this is a no-op if array is not an actual JSON array

Definition at line 72 of file simple_json_array.c.

void sj_array_free ( SJson array)

Definition at line 51 of file simple_json_array.c.

SJson* sj_array_get_nth ( SJson array,
int  n 
)

retrieve the nth element in the json array

Parameters
arraythe array to search through
nthe index of the element to get
Returns
NULL on error (check sj_get_error()) or the SJson value otherwise

Definition at line 79 of file simple_json_array.c.

SJString* sj_array_get_nth_as_string ( SJson array,
int  n 
)

retrieve the nth element in the json array assumed to be a string

Parameters
arraythe array to search through
nthe index of the element to get
Returns
NULL on error (check sj_get_error()) or the SJString value otherwise

Definition at line 85 of file simple_json_array.c.

SJson* sj_array_new ( )

allocate a new empty json array

Returns
NULL on memory allocation error, an empty SJson array otherwise

Definition at line 38 of file simple_json_array.c.

SJString* sj_array_to_json_string ( SJson array)

get the contents of the array as a formatted json string for output

Parameters
arraythe json array to convert
Returns
a formatted json character array "[*,*,....]"

Definition at line 95 of file simple_json_array.c.