Skip to content

json-iterator

A drop-in replacement for Go's standard encoding/json package that aims to be faster.json-iterator/go

Stars
13.9k
Forks
1.1k
Licence
MIT
Language
Go
Last update
2.4 years ago
Type
Library

This repository is archived and no longer maintained.

What it is

json-iterator/go is a Go library for converting Go data to and from JSON. It is meant to be a drop-in replacement for the standard library's encoding/json package, so existing code can switch over by changing the import and config. The README reports faster decode and encode times than the standard library in its own benchmark, but it notes results depend on the data.

  • Replace json.Marshal and json.Unmarshal calls with the ConfigCompatibleWithStandardLibrary configuration
  • Benchmark the library against encoding/json on your own payloads before adopting it
  • Use it as a serializer in a Go web service that handles JSON request and response bodies

Great for

  • Go developers who parse or produce large amounts of JSON and want to test a faster option
  • Teams that want to swap out encoding/json with minimal code changes
  • Projects already using the standard library API who need a compatible configuration

Not ideal for

  • Projects that need the project to be actively maintained, since the repository is archived and last pushed in May 2024
  • Teams whose JSON workload is small enough that speed differences do not matter
  • Anyone who needs a guarantee of performance gains, since the README advises benchmarking with your own workload

How to get it

  1. 1

    Install with a package manager

    You'll need: Go

    Install the library

    go get github.com/json-iterator/go
  2. 2

    Run it

    • Install the library with go get
    • Import it as jsoniter and create a variable from jsoniter.ConfigCompatibleWithStandardLibrary
    • Call Marshal or Unmarshal on that variable in place of the encoding/json calls
    • Run your existing tests to confirm behavior matches
  3. 3

    Get the most out of it

    • Read the migration guide linked from the README for details beyond the basic replacement
    • Run your own benchmarks with realistic payloads, as the README recommends
    • Check the pkg.go.dev documentation linked from the README for the full API

Downloads

Strengths

  • The README describes it as 100% compatible with encoding/json for the documented migration path
  • Migration is shown as a small import and variable change
  • Released under the MIT license

Trade-offs

  • The repository is archived, so it is unlikely to receive fixes or updates
  • The benchmark is the project's own and results depend heavily on the input data
  • The README is short and points to an external site for detailed documentation

How it compares

ProjectStarsTypeLevelUpdatedBest for
go (this)13.9kLibrarybeginner2.4 years agoGo developers who parse or produce large amounts of JSON and want to test a faster option
gjson15.6kLibrarybeginner1 months agoGo developers who need a few fields from a JSON response without writing struct definitions
json50.8kLibrarybeginner4 days agoC++ developers who need to read or write JSON in an application
SwiftyJSON22.9kLibrarybeginner3 months agoSwift developers building iOS, macOS, tvOS or watchOS apps that read JSON from web APIs
zerolog12.5kLibrarybeginner23 days agoGo developers who want machine-readable JSON logs
yq16.2kCLIbeginner8 days agoDevelopers who regularly edit YAML config files in scripts or CI pipelines

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.