encoding/json: Add Encoder.Indent #6492
This is a feature request for encoding/json post-Go 1.2 It would be great if json.Encoder had an Indent method like xml.Encoder does. Currently the only way to get indented JSON is to use MarshalIndent but that requires an intermediate byte.
The text was updated successfully, but these errors were encountered:
gopherbot pushed a commit that referenced this issue
May 24, 2016
CL 21057 added this method during the Go 1.7 cycle (so it is not yet released and still possible to revise). This makes it clearer that the method is not doing something (like func Indent does), but just changing a setting about doing something later. Also document that this is in some sense irreversible. I think that's probably a mistake but the original CL discussion claimed it as a feature, so I'll leave it alone. For #6492. Change-Id: If4415c869a9196501056c143811a308822d5a420 Reviewed-on: https://go-review.googlesource.com/23295 Reviewed-by: Ian Lance Taylor <email@example.com> Reviewed-by: Andrew Gerrand <firstname.lastname@example.org> Run-TryBot: Russ Cox <email@example.com>