buger /jsonparser

THE fastest alternative JSON parser for Go that does not require schema

★ 5,668⑂ 464👁 96⑃ 147● 139▤ 12
下载:v1.6.1 — Fastest across all payload sizes (now benchmarks vs gjson + sonic)v1.6.1 ↓1.6.12026-07-30
+0
日增长
5,668
stars
464
forks
96
watchers
147
prs
139
issues
12
releases

README

!License
 The fastests JSON parser for Go

It does not require you to know the structure of the payload (eg. create structs), and allows accessing fields by providing the path to them. It is up to 6.5x faster than standard encoding/json package (depending on payload size and usage), allocates no memory. See benchmarks below.

Project recently celebrated 10 years!

---

 🔒 Formally Verified — the first Go library proven to L3 assurance by ReqProof



jsonparser is the reference case study for ReqProof — a git-native requirements-engineering and formal-verification platform. Every public API is traced to a formal requirement, every requirement is tested with 100% Modified Condition/Decision Coverage (MC/DC), and the entire parser is fuzzed by a custom structure-aware JSON fuzzer (github.com/probelabs/json-fuzz) that generates grammar-valid mutations at 250,000 inputs/second.

| Metric | Value |
|---|---|
| Requirements traced | 118 (7 stakeholder + 111 system) |
| Proof audit | 0 errors, 0 warnings (L3 strict) |
| Code-level MC/DC | 100% decisions, 100% conditions |
| Requirement-side MC/DC | 377/377 witness rows covered |
| Fuzz executions | 16M+ (structure-aware + path-mutation + encoding/json differential) |
| Bugs found & fixed by the proof review | 7 (4 panics, 2 data-corruption, 1 encoding bug) |

The proof review caught bugs that years of community use, OSS-Fuzz, and standard fuzzing had missed — including a panic class across 8 unchecked-dereference sites, a silent data-loss bug in Set, and a malformed-output bug in Delete. Read the full root-cause analysis →

---

 Rationale
Originally I made this for a project that relies on a lot of 3rd party APIs that can be unpredictable and complex.
I love simplicity and prefer to avoid external dependecies. encoding/json requires you to know exactly your data structures, or if you prefer to use map[string]interface{} instead, it will be very slow and hard to manage.
I investigated what's on the market and found that most libraries are just wrappers around encoding/json, there is few options with own parsers (ffjson, easyjson), but they still requires you to create data structures.


Goal of this project is to push JSON parser to the performance limits and not sacrifice with compliance and developer user experience.

 Example
For the given JSON our goal is to extract the user's full name, number of github followers and avatar.

go
import "github.com/buger/jsonparser"

...

data := []byte({
  "person": {
    "name": {
      "first": "Leonid",
      "last": "Bugaev",
      "fullName": "Leonid Bugaev"
    },
    "github": {
      "handle": "buger",
      "followers": 109
    },
    "avatars": [
      { "url": "https://avatars1.githubusercontent.com/u/14009?v=3&s=460", "type": "thumbnail" }
    ]
  },
  "company": {
    "name": "Acme"
  }
})

// You can specify key path by providing arguments to Get function
jsonparser.Get(data, "person", "name", "fullName")

// There is GetInt and GetBoolean helpers if y

Top issues

Latest release

v1.6.1 — Fastest across all payload sizes (now benchmarks vs gjson + sonic) v1.6.1 2026-07-30
🔒 Covered by ReqProof — L3 Assurance (123 requirements, 0 errors, 0 warnings)

 Performance — gjson-style fast-skip

Ported gjson's '\\' single-comparison fast-skip to three hot loops. The trick skips all non-structural bytes (those  0x5C) in one unsigned comparison per byte, reducing branch overhead.

| Payload | Before | After | Change |
|---|---|---|---|
| Small (190B) | 382 ns | 339 ns | -11.3% |
| Medium (2.4kB) | 3,899 ns | 3,141 ns | -19.4% |
| Large (24kB) | 20,788 ns | 20,114 ns | -3.2% |

 Now benchmarks against gjson and sonic

Added tidwall/gjson (15.5k⭐) and bytedance/sonic (9.6k⭐

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON