From: kanna Date: Thu, 30 Oct 2014 12:34:03 +0000 (-0700) Subject: lldpcli: pretty print json X-Git-Tag: 0.7.12~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=625005be708dfe52074448c6b3a2bb26b43a415b;p=thirdparty%2Flldpd.git lldpcli: pretty print json Signed-off-by: Kanna Rajagopal --- 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); }