mirror of
https://github.com/nlohmann/json
synced 2024-12-17 22:51:07 +00:00
fixed #31: only use spaces in pretty print
This commit is contained in:
parent
b30e9ee5f4
commit
7724d34741
@ -142,8 +142,6 @@ std::cout << j.dump(4) << std::endl;
|
||||
// }
|
||||
```
|
||||
|
||||
The value of s could be `{"pi": 3.141, "happy": true}`, but the order of the entries in the object is not fixed.
|
||||
|
||||
You can also use streams to serialize and deserialize:
|
||||
|
||||
```cpp
|
||||
|
@ -1019,7 +1019,8 @@ std::string json::dump(const bool prettyPrint, const unsigned int indentStep,
|
||||
{
|
||||
result += prettyPrint ? ",\n" : ",";
|
||||
}
|
||||
result += indent() + "\"" + i->first + "\": " + i->second.dump(prettyPrint, indentStep,
|
||||
result += indent() + "\"" + i->first + "\":" + (prettyPrint ? " " : "") + i->second.dump(
|
||||
prettyPrint, indentStep,
|
||||
currentIndent);
|
||||
}
|
||||
|
||||
|
@ -567,7 +567,8 @@ std::string json::dump(const bool prettyPrint, const unsigned int indentStep,
|
||||
{
|
||||
result += prettyPrint ? ",\n" : ",";
|
||||
}
|
||||
result += indent() + "\"" + i->first + "\": " + i->second.dump(prettyPrint, indentStep,
|
||||
result += indent() + "\"" + i->first + "\":" + (prettyPrint ? " " : "") + i->second.dump(
|
||||
prettyPrint, indentStep,
|
||||
currentIndent);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user