Extract specific fields from third-party API responses without defining a full Go struct for every response shape.
Process large volumes of JSON messages with minimal memory allocation and reduced garbage collection pressure.
Read multiple fields from one JSON payload in a single scan using EachKey, instead of calling Get multiple times.
Iterate over all elements in a JSON array or all key-value pairs in an object with a single function call.
| buger/jsonparser | cri-o/cri-o | russross/blackfriday | |
|---|---|---|---|
| Stars | 5,612 | 5,611 | 5,617 |
| Language | Go | Go | Go |
| Setup difficulty | easy | hard | easy |
| Complexity | 2/5 | 4/5 | 2/5 |
| Audience | developer | ops devops | developer |
Figures from each repo's GitHub metadata at analysis time.
jsonparser is a Go library for reading JSON data quickly, without needing to define the shape of the data in advance. Go's built-in JSON package requires you to write out a struct that matches the structure of the JSON you plan to receive. If the data comes from a third-party API and its structure is unpredictable or changes over time, that approach gets awkward. jsonparser lets you pull out individual fields by specifying a path, more like looking something up in a nested dictionary than mapping the whole thing to a type. The library's main selling point is speed. According to the benchmarks in the README, it can be up to ten times faster than Go's standard encoding/json package, and it avoids memory allocation during parsing. That makes it useful in high-throughput situations where you are processing a large number of JSON responses and do not want garbage collection pressure from repeated allocations. The API centers on a Get function that takes the raw JSON bytes and a sequence of keys that form a path into the document. For example, to read a nested field you pass the outer key first, then the inner key, and the function returns the value as a byte slice along with its type. There are helper functions for common types: GetString, GetInt, GetFloat, and GetBoolean. Arrays can be iterated with ArrayEach, which calls a function for each element. ObjectEach does the same for key-value pairs in an object. For cases where you need to read several different fields from the same document, an EachKey function scans the payload only once and calls your callback each time it finds one of the paths you listed. This is more efficient than calling Get multiple times, since each Get call reads through the data independently. The library also includes a Set function for writing or updating values in existing JSON bytes. The README includes extensive code examples and benchmark comparisons against other Go JSON libraries.
jsonparser is a Go library for reading specific fields from JSON data up to 10x faster than Go's built-in JSON package, without needing to define data structures for the whole document upfront.
Mainly Go. The stack also includes Go.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.