8 static const char * STRTOK_PATH =
".[]";
11 if(( root == NULL )||( jsonpath == NULL )||( dest == NULL )) {
14 char * tokenized = strdup( jsonpath );
15 if( tokenized == NULL ) {
18 char * token = strtok( tokenized, STRTOK_PATH );
24 while( iter && token ) {
25 if( isdigit( *token )) {
27 long unsigned index = strtoul( token, &err, 10 );
56 iter = &((*pair)->element);
58 token = strtok( NULL, STRTOK_PATH );
JST_Error JST_get(const char *jsonpath, JST_Element *root, JST_Element **dest)
Search an element by its path.
struct JST_Pair_ ** items
Array of JST_Pair, ordered by JST_Pair.name to ease search with bsearch()
char * name
This property's name.
int JST_pairs_compare(const void *left, const void *right)
A object attribute item has a parent and is a named-typed-value pair.
An array item has a parent and a typed value.
An element is a typed value.
struct JST_ArrayItem_ ** items
Array of JST_ArrayItem.
unsigned count
Cardinality of the previous array.
unsigned count
Cardinality of the previous array.