From 625005be708dfe52074448c6b3a2bb26b43a415b Mon Sep 17 00:00:00 2001 From: kanna Date: Thu, 30 Oct 2014 05:34:03 -0700 Subject: [PATCH] lldpcli: pretty print json Signed-off-by: Kanna Rajagopal --- src/client/jsonc_writer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/jsonc_writer.c b/src/client/jsonc_writer.c index db9de438..28e764b2 100644 --- a/src/client/jsonc_writer.c +++ b/src/client/jsonc_writer.c @@ -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); } -- 2.39.5