]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpcli: pretty print json
authorkanna <kanna@cumulusnetworks.com>
Thu, 30 Oct 2014 12:34:03 +0000 (05:34 -0700)
committerVincent Bernat <vincent@bernat.im>
Thu, 30 Oct 2014 12:50:47 +0000 (13:50 +0100)
Signed-off-by: Kanna Rajagopal <kanna@cumulusnetworks.com>
src/client/jsonc_writer.c

index db9de438c6577602f933a6cfe83b73786cdf48b4..28e764b2db4436b36cfd4b523b199c7744cc43a7 100644 (file)
@@ -137,11 +137,13 @@ jsonc_finish(struct writer *w)
                /* memory will leak... */
        } else {
                struct json_element *first = TAILQ_FIRST(p);
-               fprintf(stdout, "%s", json_object_to_json_string(first->el));
+               int json_flags = (JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED);
+               fprintf(stdout, "%s", json_object_to_json_string_ext(first->el, json_flags));
                json_object_put(first->el);
                TAILQ_REMOVE(p, first, next);
                free(first);
        }
+       fprintf(stdout, "\n");
        free(p);
        free(w);
 }