diff --git a/kson.c b/kson.c index c5002fb..a8bf160 100644 --- a/kson.c +++ b/kson.c @@ -135,7 +135,7 @@ kson_t *kson_parse(const char *json) *** Query *** *************/ -const kson_node_t *kson_query(const kson_node_t *p, int depth, ...) +const kson_node_t *kson_by_path(const kson_node_t *p, int depth, ...) { va_list ap; va_start(ap, depth); @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) } else { kson = kson_parse("{'a' : 1,'b':[0,'isn\\'t',true],'d':[{\n\n\n}]}"); if (kson) { - const kson_node_t *p = kson_query(kson->root, 2, "b", 1); + const kson_node_t *p = kson_by_path(kson->root, 2, "b", 1); if (p) printf("*** %s\n", p->v.str); else printf("!!! not found\n"); kson_format(kson->root); diff --git a/kson.h b/kson.h index 9c0eafc..a03eb52 100644 --- a/kson.h +++ b/kson.h @@ -34,7 +34,7 @@ extern "C" { kson_t *kson_parse(const char *json); void kson_destroy(kson_t *kson); - const kson_node_t *kson_query(const kson_node_t *root, int max_depth, ...); + const kson_node_t *kson_by_path(const kson_node_t *root, int path_len, ...); void kson_format(const kson_node_t *root); #ifdef __cplusplus