#ifndef JSON_TREE_H
#define JSON_TREE_H
#include "json-parser.h"
/* Direct access to this structure is not encouraged, use the inline
function accessors where possible, so that the implementation
details can remain fluid, or, even better, hidden. */
struct json_tree_node {
/* object key, or NULL if we're in a list */
const char *key;
struct {
/* for JSON_TYPE_OBJECT and JSON_TYPE_ARRAY */
/* for other types */
const char *str;
} value;
};
static inline ATTR_PURE const struct json_tree_node *json_tree_get_child(const struct json_tree_node *node)
{
}
{
}
/* You can build a list or an object, nothing else. */
{
return json_tree_init_type(JSON_TYPE_OBJECT);
}
{
return json_tree_init_type(JSON_TYPE_ARRAY);
}
Returns 0 on success, -1 if the input was invalid (which should never happen
if it's coming from json-parser). */
const char *value);
/* Return the root node. */
const struct json_tree_node *
/* Find a node with the specified key from an OBJECT node */
const struct json_tree_node *
/* Find an object node (from an array), which contains the specified key=value
in its values. */
const struct json_tree_node *
#endif