{
  "id": 18163031,
  "title": "A new Go API for JSON - The Go Programming Language",
  "url": "https://urgent.news/2026/11/04/a-new-go-api-for-json-the-go-programming-language",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-04T17:52:32.000Z",
  "source": {
    "name": "Lobsters",
    "slug": "lobsters",
    "url": "https://go.dev/blog/jsonv2"
  },
  "original_language": "en",
  "account": "The Go Programming Language has introduced a new JSON API, dubbed encoding/json/v2 and encoding/json/jsontext, in Go version 1.27, following several years of development and refinement. These packages aim to address long-standing issues with the original encoding/json package, which has been a staple of the Go standard library since before its initial release. While the existing JSON package has proven robust and flexible in marshaling and unmarshaling Go types to and from JSON, it has also been plagued with various shortcomings that have frustrated users and introduced potential security vulnerabilities.\n\nAmong the key issues with encoding/json are imprecise handling of JSON syntax, allowing invalid UTF-8 and duplicate member names. This can lead to data corruption and security exploits, as exemplified by CVE-2017-12635. Furthermore, encoding/json leaks nilness of slices and maps, marshaling nil slices or maps as JSON nulls, which may cause errors when unmarshaling by other JSON implementations. Another issue is the case-insensitive unmarshaling, which can be a security vulnerability and a performance limitation. Moreover, the inconsistent calling of MarshalJSON methods on pointer receivers and the restrictive API options limit user flexibility.\n\nThe new JSON API aims to rectify these issues by providing a more precise and secure handling of JSON syntax, rejecting invalid UTF-8 and duplicate member names. It also improves the marshaling and unmarshaling of nil slices and maps to better align with the JSON standard. The new API offers more flexible options for unmarshaling from an io.Reader and allows for customizing the behavior of Encoder and Decoder types, including options passed down the call stack. Additionally, the new API improves performance by avoiding memory allocation and enabling streaming, allowing for more efficient processing of large JSON values.\n\nDespite these improvements, introducing a new major version of a package requires careful consideration, as it may disrupt existing applications that rely on the current API. Instead, the new JSON API provides an alternative package with improved functionality and security, encouraging users to adopt it and gradually migrate from the original encoding/json package. This approach allows for a more gradual and safer transition, minimizing disruptions while ensuring a more robust and secure JSON handling experience for Go programmers.",
  "summary": null,
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}