Radar · Go · Archive · Week 24 · Jun 8 – 14, 2026
encoding/json/v2: new API for encoding/json
Worth knowingstdlib
- What changed
- A new
encoding/json/v2package and aencoding/json/jsontextpackage have been proposed, adding a new API surface for JSON handling. - Production impact
- The source does not say.
- Try it
- Read the proposal at the linked issue to see the new API signatures and experiment with them on a development branch.
- Source
- github.com/golang/go/issues/71497
Understand it, then run it
The Go standard library has a package called encoding/json that turns Go values into JSON and back again. A new proposal introduces two new packages: encoding/json/v2 and encoding/json/jsontext. The idea is to split the work into a low‑level, syntax‑only layer (jsontext) and a higher‑level, value‑oriented layer (json/v2). The existing encoding/json will be rewritten to use the new v2 package, so the public API you use today will stay the same, but behind the scenes the code will be cleaner and more efficient.
Run it now
package main
import (
"encoding/json"
"fmt"
)
func main() {
// The existing json package is still available in Go 1.27.1.
// It will be rewritten to use the new v2 API in a future release.
data, _ := json.Marshal(map[string]int{"a": 1})
fmt.Println(string(data))
}
What it printed when we ran it on Go 1.27.1
{"a":1}
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed