-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
This is an adjunct proposal to #71497.
#71497 proposes adding a new JSON API, consisting of encoding/json/v2 and encoding/json/jsontext packages. The existing encoding/json package is modified to use the new v2 implementation internally. Several new functions are added to encoding/json. See that proposal for details.
The proposed new API is implemented in github.com/go-json-experiment/json.
I propose that we merge the implementation in github.com/go-json-experiment/json into std immediately, enabled only when the GOEXPERIMENT=jsonv2 experiment flag is set.
When the jsonv2 experiment flag is not enabled, there will be no user-visible changes to std. The encoding/json package will exist exactly as it is now, and the proposed new packages will not exist.
When GOEXPERIMENT=jsonv2 is set:
- The new
encoding/json/v2andencoding/json/jsontextpackages will exist. - The
encoding/jsonpackage will be implemented in terms ofencoding/json/v2. - The
encoding/jsonpackage will include the new APIs proposed in proposal: encoding/json/v2: new API for encoding/json #71497.
The experimental API will not be bound by the Go compatibility promise and will evolve as updates are made to #71497.
If #71497 isn't approved in time for Go 1.25, we can either ship 1.25 with the GOEXPERIMENT guard or revert the experimental API in the 1.25 release. If #71497 is rejected, we'll remove the experimental package.
This proposal presumes that while there are still details being resolved, #71497 is on track for acceptance and we're happy with the general structure of the proposed API. Merging it into the main go repository prior to acceptance will make it easier for users to test out the new implementation.
Metadata
Metadata
Assignees
Type
Projects
Status
Status