librelist archives

« back to archive

Parsing Boolean Values with yajl tree

Parsing Boolean Values with yajl tree

Joseph Rosensweig
2012-07-16 @ 19:12
Hey all,

   I was taking a look at the yajl tree api.  I added this line to the
parse_config.c code:

+    {
+        const char * path[] = { "UsageReporting", "enabled", (const char
*) 0 };
+        yajl_val v = yajl_tree_get(node, path, yajl_t_any);
+        if (v) printf("%s/%s: %d\n", path[0], path[1], YAJL_IS_TRUE(v));
+        else   printf("no such node: %s/%s\n", path[0], path[1]);
+    }

    This reports that no such node was found.  Am I doing something wrong
here?  I tried a couple variations of this but the parser never gave me a
valid handle.