Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: encoding/json: add way to skip newlines while identation of simple arrays #19171
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.
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.