static inline const kson_node_t *kson_by_key(const kson_node_t *p, const char *key)
{
long i;
+ if (p->type != KSON_TYPE_BRACE) return 0;
for (i = 0; i < (long)p->n; ++i) {
const kson_node_t *q = p->v.child[i];
if (q->key && strcmp(q->key, key) == 0)
static inline const kson_node_t *kson_by_index(const kson_node_t *p, long i)
{
+ if (p->type != KSON_TYPE_BRACKET) return 0;
return 0 <= i && i < (long)p->n? p->v.child[i] : 0;
}