Repository navigation
Description
Proposal Details
With Go 1.28 prospectively having typed struct tags in some form or another, the json/v2 working group decided to remove support for the format tag option since this would be more naturally expressed as a typed struct tag.
The implementation for format will not be eliminated, but instead be guarded behind a goexperiment flag (e.g., GOEXPERIMENT=jsonformat. This allows for a path forward for existing users of the format flag until Go 1.28, which hopefully provides first-class support for equivalent behavior in a different way.
Sorry for the confusion, the first comment is out of date, we decided against providing a GOEXPERIMENT to re-enable support for the format tag.
Support for this tag remains available via github.com/go-json-experiment/json.ExperimentalSupportFormatTag, but I want to stress that it remains unsupported and experimental. A future version of Go will remove the format tag entirely and even break calls using github.com/go-json-experiment/json.ExperimentalSupportFormatTag.
To be clear, we do want a mechanism for controlling field formatting, but we hope to provide a mechanism that is both easier to use and more flexible, probably based on a language change like #74472. We removed format because w…
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
gabyhelp commentedon May 1, 2026
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
gopherbot commentedon May 4, 2026
Change https://go.dev/cl/773980 mentions this issue:
encoding/json/v2: supportformattag option behind goexperimentencoding/json/v2: support `format` tag option behind goexperiment
gopherbot commentedon Jun 8, 2026
Change https://go.dev/cl/788420 mentions this issue:
encoding/json/v2: support format tag via runtime Optionencoding/json/v2: support format tag via runtime Option
gopherbot commentedon Jun 9, 2026
Change https://go.dev/cl/788862 mentions this issue:
encoding/json: drop documentation mention offormat``encoding/json: drop documentation mention of `format`
nikolaydubina commentedon Aug 19, 2026
is this alive? I am getting
prattmic commentedon Aug 20, 2026
Sorry for the confusion, the first comment is out of date, we decided against providing a GOEXPERIMENT to re-enable support for the
formattag.Support for this tag remains available via
github.com/go-json-experiment/json.ExperimentalSupportFormatTag, but I want to stress that it remains unsupported and experimental. A future version of Go will remove theformattag entirely and even break calls usinggithub.com/go-json-experiment/json.ExperimentalSupportFormatTag.To be clear, we do want a mechanism for controlling field formatting, but we hope to provide a mechanism that is both easier to use and more flexible, probably based on a language change like #74472. We removed
formatbecause we don't want to introduce a new tag (to be supported indefinitely), only to introduce a replacement mechanism a few releases later.dumindu commentedon Aug 20, 2026
This code was really clean without any middle types. 🥺
PS: I meant. We don't need to maintain middle types(JSONDate) and errors on serialization/ deserialization failure types of those middle types, while writing Go programs.
dumindu commentedon Aug 20, 2026
@prattmic @dsnet @neild Other proposed options are more complex and messy syntax than this. I hope, we will not get a field formatting syntax at least for 3-4 Go versions; As It literally trying to revamp the way we write Structs. Why can't we keep supporting this already existing experiment under
GOEXPERIMENT=jsonformattill we get the proposed one?bronger commentedon Aug 28, 2026
Do I have to expect a time gap between removal of
ExperimentalSupportFormatTagand the new way to support formatting?