Browse Source

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

0.10
Jeff Garzik 10 years ago
parent
commit
dee9324a0b
  1. 11
      src/univalue/univalue_write.cpp

11
src/univalue/univalue_write.cpp

@ -91,8 +91,11 @@ void UniValue::writeArray(unsigned int prettyIndent, unsigned int indentLevel, s @@ -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, @@ -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 += ",";

Loading…
Cancel
Save