-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I tried some change to dump() for [1,2,3...] #2584
Comments
In order to asses your issue, we need the following information:
|
I think function dump(4), pretty print not good enougf, it will use too many lines for arry of int. |
I am not sure that such a fix is helpful for everybody, and we have no real way to support all kinds of configurations at the moment. Best would be a way to implement user-defined serializers (maybe using the SAX interface, see #2275). |
function dump under pretty print maybe not good enough,it will use too many lines.
I tried some change to dump(),maybe can be accepted.
when json j is [1,2,3...],use j.dump(4),get:
[
1,
2,
3,
...
]
I want get [1,2,3..] in one line
so, I changed here:
void dump(const BasicJsonType& val, const bool pretty_print,
const bool ensure_ascii,
const unsigned int indent_step,
const unsigned int current_indent = 0)
...
case value_t::array:
{
if (val.m_value.array->empty())
{
o->write_characters("[]", 2);
return;
}
...
now, when json j is [[1,2,3,4,5,6,7,8,9,10,11],[1,2,3,4,5,6,7,8,9,0],[1,2,3,4,5,6,7,8,9],["1",1]],
j.dump(4) will get:
[
[
1,2,3,4,5,6,7,8,9,10,
11
],
[1,2,3,4,5,6,7,8,9,0],
[1,2,3,4,5,6,7,8,9],
[
"1",
1
]
]
The text was updated successfully, but these errors were encountered: