From: adam Date: Fri, 19 Jul 2013 04:18:41 +0000 (+0700) Subject: fix of array exporting in json export mode X-Git-Tag: v1.2.12~257 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f549aa02a8de61c501d62653381e31e2e4752454;p=platform%2Fupstream%2Fejdb.git fix of array exporting in json export mode --- diff --git a/package.json b/package.json index 453060a..f977639 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name" : "ejdb", - "version" : "1.1.14-3", + "version" : "1.1.14-4", "config" : { "windownloadurl_ia32" : "http://dl.dropboxusercontent.com/u/4709222/ejdb/tcejdb-1.1.14-mingw32-i686.zip", "windownloadurl_x64" : "http://dl.dropboxusercontent.com/u/4709222/ejdb/tcejdb-1.1.14-mingw32-x86_64.zip" diff --git a/tcejdb/bson.c b/tcejdb/bson.c index e873bff..00a86f8 100644 --- a/tcejdb/bson.c +++ b/tcejdb/bson.c @@ -2052,13 +2052,20 @@ static int _bson2json(_BSON2JSONCTX *ctx, bson_iterator *it, bool array) { int c = 0; while ((bt = bson_iterator_next(it)) != BSON_EOO) { if (c++ > 0) { + if (array) { + tcxstrcat2(out, "\n"); + BSPAD(0); + } tcxstrcat2(out, ",\n"); } const char *key = bson_iterator_key(it); BSPAD(0); - tcxstrcat2(out, "\""); - _jsonxstrescaped(out, key); - tcxstrcat2(out, "\" : "); + if (!array) { + tcxstrcat2(out, "\""); + _jsonxstrescaped(out, key); + tcxstrcat2(out, "\" : "); + } + switch (bt) { case BSON_LONG: case BSON_INT: