UniValue: compact (!pretty) output should not include extra whitespace

This commit is contained in:
Jeff Garzik 2014-08-20 00:14:53 -04:00
parent 42642c9695
commit dee9324a0b

View File

@ -91,8 +91,11 @@ void UniValue::writeArray(unsigned int prettyIndent, unsigned int indentLevel, s
if (prettyIndent)
s += indentStr(prettyIndent, indentLevel);
s += values[i].write(prettyIndent, indentLevel + 1);
if (i != (values.size() - 1))
s += ", ";
if (i != (values.size() - 1)) {
s += ",";
if (prettyIndent)
s += " ";
}
if (prettyIndent)
s += "\n";
}
@ -111,7 +114,9 @@ void UniValue::writeObject(unsigned int prettyIndent, unsigned int indentLevel,
for (unsigned int i = 0; i < keys.size(); i++) {
if (prettyIndent)
s += indentStr(prettyIndent, indentLevel);
s += "\"" + json_escape(keys[i]) + "\": ";
s += "\"" + json_escape(keys[i]) + "\":";
if (prettyIndent)
s += " ";
s += values[i].write(prettyIndent, indentLevel + 1);
if (i != (values.size() - 1))
s += ",";