proposal: json: add Encoder.EncodeIndent #23508
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Proposal
Suggested
Issues that may be good for new contributors looking for work to do.
Milestone
What version of Go are you using (
go version
)?1.9.2
What operating system and processor architecture are you using (
go env
)?macOS/amd64
The
encoding/json
package has a very useful methodMarshalIndent
which allows users to create indented (pretty-printed) JSON. However when creating ajson.Encoder
there is no one-shot method forEncodeIndent
. We have the ability toHowever, a one-shot method like
EncodeIndent(&data, "", " ")
would make this code much more concise and follow the same format asMarshalIndent
. The above code would change toThe text was updated successfully, but these errors were encountered: