The whitespace for the current pretty mode is awkward and weird. Move
to a more standard approach. It's more newlines, but *much* more
readable.
Signed-off-by: Sage Weil <sage@redhat.com>
} else {
m_ss << ",";
}
- } else if (entry.is_array && m_pretty) {
+ } else if (m_pretty) {
m_ss << "\n";
for (unsigned i = 1; i < m_stack.size(); i++)
m_ss << " ";
print_comma(entry);
if (!entry.is_array) {
if (m_pretty) {
- if (entry.size)
- m_ss << " ";
- else
- m_ss << " ";
+ m_ss << " ";
}
m_ss << "\"" << name << "\"";
if (m_pretty)
finish_pending_string();
struct json_formatter_stack_entry_d& entry = m_stack.back();
+ if (m_pretty && entry.size) {
+ m_ss << "\n";
+ for (unsigned i = 1; i < m_stack.size(); i++)
+ m_ss << " ";
+ }
m_ss << (entry.is_array ? ']' : '}');
m_stack.pop_back();
}