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).
Preffered (imho) indentation:
"array": [ 1, 2, 3 ]
The text was updated successfully, but these errors were encountered:
changed the title
encoding/json add way to skip newlines while identation of simple arraysFeb 18, 2017
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.