You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently json.Indent produces very huge output when used arrays of standard types (number, bool, string). So this output is not usable for human reading. Human never break line after each array item of int, for example.
So I suggest do not break them (only huge arrays may be created as some number of items per line).
Current indentation:
{
"array": [
1,
2,
3
]
}
Preffered (imho) indentation:
{
"array": [ 1, 2, 3 ]
}
The text was updated successfully, but these errors were encountered:
ALTree
changed the title
encoding/json add way to skip newlines while identation of simple arrays
encoding/json: add way to skip newlines while identation of simple arrays
Feb 18, 2017
ALTree
added
the
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
label
Feb 18, 2017
ALTree
changed the title
encoding/json: add way to skip newlines while identation of simple arrays
proposal: encoding/json: add way to skip newlines while identation of simple arrays
Feb 18, 2017
I've turned this into a proposal since implementing this change will probably require adding a new function to the json package and/or changing Indent in a significant way.
encoding/json isn't meant to be human-readable. It's nice that it is, but that's not a key part of the design of the package. It's easy enough for packages higher up the stack to do JSON reformatting, especially since they can assume or check (using encoding/json) that the input is valid JSON.
We're not going to go down the path of turning encoding/json into jsonfmt and then arguing about exactly how it should be formatted.
Currently json.Indent produces very huge output when used arrays of standard types (number, bool, string). So this output is not usable for human reading. Human never break line after each array item of int, for example.
So I suggest do not break them (only huge arrays may be created as some number of items per line).
Current indentation:
{
"array": [
1,
2,
3
]
}
Preffered (imho) indentation:
{
"array": [ 1, 2, 3 ]
}
The text was updated successfully, but these errors were encountered: