Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/json: Add Encoder.Indent #6492

Closed
kisielk opened this issue Sep 26, 2013 · 10 comments
Closed

encoding/json: Add Encoder.Indent #6492

kisielk opened this issue Sep 26, 2013 · 10 comments

Comments

@kisielk
Copy link
Contributor

kisielk commented Sep 26, 2013

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.
@adg
Copy link
Contributor

adg commented Sep 27, 2013

Comment 1:

Labels changed: added priority-later, feature, removed priority-triage.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 3:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added repo-main.

@rwxrob
Copy link

rwxrob commented Jun 6, 2015

Any word on this? I might take a stab at since I need it at the moment.

@bradfitz
Copy link
Contributor

bradfitz commented Jun 6, 2015

Stab away.

@cespare
Copy link
Contributor

cespare commented Nov 26, 2015

I'm going to try to do this for 1.7.

@gopherbot
Copy link

CL https://golang.org/cl/21057 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/23295 mentions this issue.

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 <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
@golang golang locked and limited conversation to collaborators May 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants