Skip to content

Commit

Permalink
UniValue: compact (!pretty) output should not include extra whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Garzik committed Aug 20, 2014
1 parent 42642c9 commit dee9324
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/univalue/univalue_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand All @@ -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 += ",";
Expand Down

0 comments on commit dee9324

Please sign in to comment.