Go's json/v2 API becomes generally available

Go 1.27 makes a redesigned JSON API generally available, bringing stricter defaults, composable options, streaming primitives, and room to fix compatibility-constrained behavior without breaking encoding/json users.

Logged at IST: 2026-08-25 20:19 IST; updated 2026-11-05

What it is: The Go team's announcement that encoding/json/v2 and encoding/json/jsontext are stable and generally available in Go 1.27, alongside a practical migration guide by Anton Zhiyanov.

Gist: The v2 API addresses longstanding limitations in the original encoding/json: ambiguous or surprising behavior around invalid UTF-8, duplicate object names, nil slices/maps, and case-insensitive field matching; awkward option plumbing; and limitations in streaming and custom-marshaler performance. The lower-level jsontext package provides JSON syntax and token-level facilities, while json/v2 builds Go-value marshaling and unmarshaling on top. A separate /v2 namespace allows behavior to improve without breaking the Go 1 compatibility promise.

The migration guide maps the changed APIs and defaults, including composable options, streaming custom marshaling, and compatibility considerations. These changes can improve correctness and flexibility, but migration requires checking which v1 behaviors an application relies on and choosing options deliberately.

Source read: https://go.dev/blog/jsonv2

Related: Go 1.27 release notes; Anton Zhiyanov's migration guide.

Newsletter angle: A substantial standard-library evolution: stricter JSON behavior and a more composable, streaming API, delivered under a new import path to preserve compatibility for existing Go programs.