浏览代码

HPCC-9089 Improve Roxie basic JSON formatting

Clean up basic JSON formatting to represent of each output as
a block.

Signed-off-by: Anthony Fishbeck <Anthony.Fishbeck@lexisnexis.com>
Anthony Fishbeck 12 年之前
父节点
当前提交
329f5a2e66
共有 1 个文件被更改,包括 12 次插入12 次删除
  1. 12 12
      common/thorhelper/thorxmlwrite.cpp

+ 12 - 12
common/thorhelper/thorxmlwrite.cpp

@@ -330,19 +330,19 @@ CommonJsonWriter & CommonJsonWriter::clear()
 
 void CommonJsonWriter::checkFormat(bool doDelimit, bool delimitNext, int inc)
 {
-    if (doDelimit && needDelimiter)
+    if (doDelimit)
     {
-        if (!out.length()) //new block
-           out.append(',');
-        else
-            delimitJSON(out);
-    }
-    if (!nestLimit)
-    {
-        out.append('\n').pad(indent);
-        if (inc!=0)
-            indent+=inc;
+        if (needDelimiter)
+        {
+            if (!out.length()) //new block
+               out.append(',');
+            else
+                delimitJSON(out);
+        }
+        if (!nestLimit)
+            out.append('\n').pad(indent);
     }
+    indent+=inc;
     needDelimiter = delimitNext;
 }
 
@@ -452,7 +452,7 @@ void CommonJsonWriter::outputBeginArray(const char *fieldname)
         fieldname = sep+1;
         sep = strchr(fieldname, '/');
     }
-    checkFormat(true, false, 1);
+    checkFormat(false, false, 1);
     appendJSONName(out, fieldname).append('[');
 }