Parse a JSON array with YAJL
<p>I am trying to parse an array within a JSON file, like so</p>

<pre><code>{
    "val": [5,6]
}
</code></pre>

<p>using the following code, adapted from the <code>parse_config.c</code> included with the library,</p>

<pre><code>char errbuf[1024];
yajl_val node;

long length;
char *file_data = read_file(&amp;length, "conf.json");

node = yajl_tree_parse((const char *) file_data, errbuf, sizeof(errbuf));

const char *path[] = {"val", (const char *) 0};
yajl_val v = yajl_tree_get(node, path, yajl_t_number);

if (v)
    printf("Node found.\n");
else
    printf("Can't find node %s\n", path[0]);

yajl_tree_free(node);
free(file_data);
</code></pre>

<p>This method is successful for a single value, e.g.</p>

<pre><code>{
    "val": 5
}
</code></pre>

<p>(by successful I mean that <code>v</code> is populated and <code>Node found.</code> is printed) but not for the array. What do I need to do differently for the array to be parsed?</p>

<p>Thanks.</p>