Skip to content

Commit bb90bbb

Browse files
neildgopherbot
authored andcommitted
_content/doc/go1.25: document GOEXPERIMENT=jsonv2
Change-Id: I4c9c097e155d267277e7115f32059b5bfa9a3792 Reviewed-on: https://go-review.googlesource.com/c/website/+/680575 Reviewed-by: Cherry Mui <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Damien Neil <[email protected]>
1 parent e007c7c commit bb90bbb

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

_content/doc/go1.25.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,44 @@ operate on a fake clock.
242242
The [`Wait`](/pkg/testing/synctest#Wait) function waits for all goroutines in the
243243
current bubble to block.
244244

245+
### New experimental encoding/json/v2 package {#json_v2}
246+
247+
Go 1.25 includes a new, experimental JSON implementation,
248+
which can be enabled by setting the environment variable
249+
`GOEXPERIMENT=jsonv2` at build time.
250+
251+
When enabled, two new packages are available:
252+
- The [`encoding/json/v2`](/pkg/encoding/json/v2) package is
253+
a major revision of the `encoding/json` package.
254+
- The [`encoding/json/jsontext`](/pkg/encoding/json/jsontext) package
255+
provides lower-level processing of JSON syntax.
256+
257+
In addition, when the "jsonv2" GOEXPERIMENT is enabled:
258+
- The [`encoding/json`](/pkg/encoding/json) package
259+
uses the new JSON implemenation.
260+
Marshalling and unmarshalling behavior is unaffected,
261+
but the text of errors returned by package function may change.
262+
- The [`encoding/json`](/pkg/encoding/json) package contains
263+
a number of new options which may be used
264+
to configure the marshaller and unmarshaller.
265+
266+
The new implementation performs substantially better than
267+
the existing one under many scenarios. In general,
268+
encoding performance is at parity between the implementations
269+
and decoding is substantially faster in the new one.
270+
See the [github.com/go-json-experiment/jsonbench](https://github.com/go-json-experiment/jsonbench)
271+
repository for more detailed analysis.
272+
273+
See the [proposal issue](/issue/71497) for more details.
274+
275+
We encourage users of [`encoding/json`](/pkg/encoding/json) to test
276+
their programs with `GOEXPERIMENT=jsonv2` enabled to help detect
277+
any compatibility issues with the new implementation.
278+
279+
We expect the design of [`encoding/json/v2`](/pkg/encoding/json/v2)
280+
to continue to evolve. We encourage developers to try out the new
281+
API and provide feedback on the [proposal issue](/issue/71497).
282+
245283
### Minor changes to the library {#minor_library_changes}
246284

247285
#### [`archive/tar`](/pkg/archive/tar/)
@@ -561,13 +599,6 @@ which selects the RVA23U64 user-mode application profile.
561599
<!--
562600
Output from relnote todo that was generated and reviewed on 2025-05-23, plus summary info from bug/CL: -->
563601

564-
## TODO
565-
566-
**Please turn these into proper release notes**
567-
568-
<!-- TODO: accepted proposal https://go.dev/issue/71845 (from https://go.dev/cl/665796, https://go.dev/cl/666935) -->
569-
encoding/json/v2: add new JSON API behind a GOEXPERIMENT=jsonv2 guard
570-
571602
<!-- Items that don't need to be mentioned in Go 1.25 release notes but are picked up by relnote todo
572603
Just updating old prposals
573604
accepted proposal https://go.dev/issue/30999 (from https://go.dev/cl/671795)

0 commit comments

Comments
 (0)