From 9cc37a2844ba68205d9db4fd161adbbd9526f557 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Mon, 26 Oct 2015 02:43:44 +0100 Subject: [PATCH] Fix format problem with empty objects When printing empty objects, the closing curly brace was missing one indentation level. Example from the output of test_utils: BEFORE FIX: { "foo": "bar", "child": { "grandchild": { } } } AFTER FIX: { "foo": "bar", "child": { "grandchild": { } } } --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index acfba16..0875fe6 100644 --- a/cJSON.c +++ b/cJSON.c @@ -563,7 +563,7 @@ static char *print_object(cJSON *item,int depth,int fmt,printbuffer *p) else out=(char*)cJSON_malloc(fmt?depth+4:3); if (!out) return 0; ptr=out;*ptr++='{'; - if (fmt) {*ptr++='\n';for (i=0;i