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

Comments

Projects
None yet
7 participants
@kisielk
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Sep 27, 2013

Comment 1:

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

Status changed to Accepted.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2013

Comment 3:

Labels changed: removed feature.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 4:

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

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 5:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@mariokostelac mariokostelac referenced this issue May 13, 2015

Merged

gb-list #77

@robmuh

This comment has been minimized.

Copy link

commented Jun 6, 2015

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

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jun 6, 2015

Stab away.

@cespare

This comment has been minimized.

Copy link
Contributor

commented Nov 26, 2015

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

@gopherbot

This comment has been minimized.

Copy link

commented Mar 24, 2016

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

@gopherbot gopherbot closed this in 098b626 Mar 25, 2016

@gopherbot

This comment has been minimized.

Copy link

commented May 23, 2016

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

gopherbot pushed a commit that referenced this issue May 24, 2016

encoding/json: rename Indent method to SetIndent
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.
You can’t perform that action at this time.