---
title: "A new Go API for JSON"
description: "Go 1.27 makes encoding/json/v2 and encoding/json/jsontext stable."
url: "https://swe.quest/articles/a-new-go-api-for-json-5db9bcc083b6587c"
canonical: "https://go.dev/blog/jsonv2"
source: "The Go Blog"
published: "2026-11-04"
difficulty: "medium"
kind: "Release"
reading_minutes: 14
tags: ["go","api-design","performance"]
---

# A new Go API for JSON

A post on [The Go Blog](https://swe.quest/sources/go.md), published 2026-11-04, 14 min read, Release. Original: [https://go.dev/blog/jsonv2](https://go.dev/blog/jsonv2)

## Summary

Go 1.27 makes encoding/json/v2 and encoding/json/jsontext stable. They fix long-standing v1 flaws that the Go 1 compatibility promise prevented fixing in place: acceptance of invalid UTF-8 and duplicate object names, nil slices and maps marshaling as null, case-insensitive field matching, and inconsistent MarshalJSON calls. jsontext handles streaming, syntax-only encoding and decoding of tokens and values. v2 builds on it with per-call options, caller-specified marshalers, and streaming MarshalJSONTo/UnmarshalJSONFrom methods. Unmarshal is up to 10x faster while Marshal is roughly at parity, and switching custom unmarshalers to the streaming interfaces can yield orders-of-magnitude gains, as in Kubernetes' kube-openapi.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Go](https://swe.quest/tags/go.md) (Languages)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- Go encoding/json basics ([easy posts on Go](https://swe.quest/tags/go.md?difficulty=easy))
- Go interfaces ([easy posts on Go](https://swe.quest/tags/go.md?difficulty=easy))

## Keywords

encoding/json/v2, encoding/json/jsontext, JSON, RFC 8259, Go 1.27, kube-openapi

## Related posts

- [Go Turns 17](https://swe.quest/articles/go-turns-17-44df44064c6960cc.md): The Go Blog · 2026-11-10 · Easy · 12 min read · Go, Performance engineering, Developer tools, Cryptography, Memory management
  Go's 17th anniversary recap covers Go 1.26 and 1.27. On the language side, it adds generic methods, self-referential constraints, \`new\` with an initial value, and nested struct literal keys.
- [How we made JSON.stringify more than twice as fast](https://swe.quest/articles/how-we-made-json-stringify-more-than-twice-as-fast-a8feda7c2e371e2a.md): V8 · 2025-08-04 · Hard · 7 min read · Runtimes & VMs, JavaScript, Performance engineering, Browsers
  V8 more than doubled JSON.stringify throughput on the JetStream2 json-stringify-inspector benchmark by adding an iterative, side-effect-free fast path that skips the general serializer's defensive checks.
- [Ready, steady, goa: our API setup](https://swe.quest/articles/ready-steady-goa-our-api-setup-f9a8a900b508af76.md): incident.io · 2025-08-11 · Medium · 10 min read · API design, Go, TypeScript, Developer productivity
  incident.io defines its HTTP API in Goa's design-first DSL, which generates net/http transport handlers, validation code, typed Go service interfaces, OpenAPI 3.0 specs and Go clients.
- [Bun v1.3.7](https://swe.quest/articles/bun-v1-3-7-c2527b00781a4168.md): Bun · 2026-01-27 · Medium · 20 min read · JavaScript, Runtimes & VMs, Performance engineering, Developer tools
  Bun v1.3.7 upgrades JavaScriptCore, which brings faster async/await (35%), Array.from, padStart/padEnd, array.flat and better ARM64 codegen using ccmp/ccmn chains.
- [Bun v1.1.23](https://swe.quest/articles/bun-v1-1-23-54b3cfbcfb783a45.md): Bun · 2024-08-14 · Medium · 7 min read · JavaScript, Runtimes & VMs, Performance engineering
  Bun v1.1.23 fixes 27 bugs and adds TextEncoderStream/TextDecoderStream, the TextDecoder stream option, Float16Array, and truncation of large arrays in console.log after 100 elements. console.log(string) is 50% faster: a single-string fast path that still needed extra writes for the newline and ANSI reset was dropped in favor of buffered writes.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
