Go 1.25's Experimental JSON Packages: Performance Boost and Stricter Syntax
Go 1.25 introduces experimental `encoding/json/v2` and `encoding/json/jsontext` packages to improve Go's JSON encoding and decoding capabilities. These address shortcomings in the existing `encoding/json` package, such as imprecise JSON syntax handling, performance bottlenecks, and API deficiencies. Improvements include stricter handling of invalid UTF-8, duplicate keys, and nil slices/maps. Streaming processing significantly improves performance, especially unmarshaling. While largely backward compatible, developers are encouraged to test with `GOEXPERIMENT=jsonv2` and provide feedback.
Read more