Code

sysdb: If available, use YAJL to pretty-print JSON output.
[sysdb.git] / src / tools / sysdb / command.c
index c7ca310a086230268272b46dcb7c268733b106b8..4de2b44e4fc79245027a22c5c2932bd82b46f742 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "tools/sysdb/command.h"
 #include "tools/sysdb/input.h"
+#include "tools/sysdb/json.h"
 
 #include "frontend/proto.h"
 #include "utils/error.h"
@@ -89,7 +90,9 @@ data_printer(sdb_strbuf_t *buf)
        /* At the moment, we don't care about the result type. We simply print the
         * result without further parsing it. */
        sdb_strbuf_skip(buf, 0, sizeof(uint32_t));
-       printf("%s\n", sdb_strbuf_string(buf));
+       if (sdb_json_print(buf))
+               sdb_log(SDB_LOG_ERR, "Failed to print result");
+       printf("\n");
 } /* data_printer */
 
 static struct {