Visitar URL original
encoding/json/v2: remove `format` tag option · Issue #79071 · golang/go · GitHub
Skip to content

encoding/json/v2: remove format tag option #79071

Closed

Description

@dsnet

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.

Pinned by neild

Activity

  1. moved this from Needs triage to Implementing in json/v2 working groupon Apr 30, 2026
  2. added
    LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a tool
    on May 1, 2026
  3. added
    FixPendingIssues that have a fix which has not yet been reviewed or submitted.
    on May 1, 2026
  4. gopherbot commented on May 4, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/773980 mentions this issue: encoding/json/v2: support format tag option behind goexperiment

  5. moved this from Implementing to Done in json/v2 working groupon May 5, 2026
  6. added a commit that references this issue on May 5, 2026
    0b54a75
  7. gopherbot commented on Jun 8, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/788420 mentions this issue: encoding/json/v2: support format tag via runtime Option

  8. gopherbot commented on Jun 9, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/788862 mentions this issue: encoding/json: drop documentation mention of format``

  9. nikolaydubina commented on Aug 19, 2026

    @nikolaydubina

    is this alive? I am getting

    go: unknown GOEXPERIMENT jsonformat
    
    go version go1.27.0 darwin/arm64
    
  10. prattmic commented on Aug 20, 2026

    @prattmic
    Member

    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 we don't want to introduce a new tag (to be supported indefinitely), only to introduce a replacement mechanism a few releases later.

  11. dumindu commented on Aug 20, 2026

    @dumindu
    	PublishedDate time.Time `json:"published_date,format:'2006-01-02'"`
    	CreatedAt     time.Time `json:"created_at,format:RFC3339" gorm:"autoCreateTime"`

    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.

  12. dumindu commented on Aug 20, 2026

    @dumindu

    @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=jsonformat till we get the proposed one?

  13. bronger commented on Aug 28, 2026

    @bronger

    […]

    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.

    Do I have to expect a time gap between removal of ExperimentalSupportFormatTag and the new way to support formatting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixPendingIssues that have a fix which has not yet been reviewed or submitted.LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a tool

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions