← All stories
● Covered by 1 source · 1 reportMedium impact1 neutral

Go 1.27 Introduces New JSON APIs: encoding/json/v2 and encoding/json/jsontext

🔄 Updated 2d ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • New encoding/json/v2 and encoding/json/jsontext packages are stable in Go 1.27.
  • Addresses issues in the original encoding/json package.
  • New APIs enforce valid UTF-8, rejecting invalid characters.
  • New APIs reject JSON objects with duplicate member names.

New JSON APIs in Go 1.27

Go 1.27 now includes the stable and generally available encoding/json/v2 and encoding/json/jsontext packages. These new APIs are the result of an experimental effort to improve JSON handling in Go, incorporating user feedback and refinements since their initial announcement last year.

The introduction of these packages aims to resolve various behavioral flaws and limitations present in the original encoding/json package, which has been part of the Go standard library since before Go 1.0.

Addressing Behavioral Flaws

The original encoding/json package, while flexible, exhibited several behavioral flaws. These included imprecise handling of JSON syntax, such as accepting invalid UTF-8 and objects with duplicate member names. The new APIs rectify these issues.

Specifically, encoding/json/v2 and encoding/json/jsontext now require valid UTF-8, aligning with RFC 8259, and will report errors for invalid UTF-8 instead of silent data corruption. They also reject JSON objects containing duplicate member names, which can prevent security vulnerabilities like CVE-2017-12635 and ensure a universally agreed-upon meaning for JSON values.

Impact on JSON Processing

These changes mean that Go programs using the new JSON APIs will have stricter parsing behavior, leading to more robust and secure JSON processing. Developers will benefit from clearer error reporting for malformed JSON, reducing the likelihood of unexpected behavior or data integrity issues.

The update reflects an evolution in JSON standardization, where decoders are becoming stricter to ensure consistent interpretation across different implementations and to mitigate potential security risks associated with ambiguous inputs.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →

The daily brief

One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.

One email a day. Unsubscribe in one click, any time.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~4 min · 3 stories · Nov 07

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Reporting from

Go 1.27 has released new stable JSON APIs, encoding/json/v2 and encoding/json/jsontext, which address long-standing issues in the original encoding/json package. These new packages offer stricter handling of JSON syntax, including valid UTF-8 enforcement and rejection of duplicate member names, to improve security and interoperability.