...designed to parse JSON data efficiently and to provide an easy-to-use API for working with JSON objects and arrays.
$ git clone https://github.com/rhighs/jsonc.git
$ gcc -Wall -c json.c -std=c99
Retrieves a value from a JSON object.
value
: JSON object.type
: Target C type.keys...
: Keys to access the value.
Returns: Value cast to the specified C type.
Retrieves a value from a JSON array at a given index.
__VALUE
: JSON array.__TYPE
: Target C type.IDX
: Index of the value.
Returns: Value cast to the specified C type.
Gets the length of a JSON array.
__VALUE
: JSON array.
Returns: Length of the array.
Checks if specific keys exist in a JSON object.
__VALUE
: JSON object....
: Key(s) to check.
Returns: 1
if the key(s) exist, 0
otherwise.
Determines the data type of a value associated with a key in a JSON object.
__VALUE
: JSON object.__KEY
: Key to inspect.
Returns: Data type of the value.
Sets a value for a key in a JSON object.
__VALUE
: JSON object.__KEY
: Key for the value.__TYPE
: Data type of the value.TYPE
: C type of the value.VALUE
: The value to store.
Creates a JSON number value from a numeric value.
VALUE
: Numeric value (double).
Returns: JSON value representing the number.
Creates a JSON string value from a string.
VALUE
: String (char*).
Returns: JSON value representing the string.
Creates a JSON boolean value from a boolean value.
VALUE
: Boolean value (0 for false, 1 for true, u8).
Returns: JSON value representing the boolean.
Creates a JSON null value.
Returns: JSON null value.
Creates a JSON property with a key-value association.
KEY
: Key for the property (char*).VALUE
: JSON value associated with the key.
Returns: JSON property with the specified key and value.
Creates a JSON object with a list of properties.
Returns: JSON object containing the specified properties.