Skip to content

json-iterator/go

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
November 30, 2017 10:42
July 1, 2018 13:05
July 1, 2018 13:05
November 30, 2016 08:30
September 11, 2021 10:17
October 24, 2018 21:05
February 19, 2018 23:04
February 19, 2018 23:04
February 19, 2018 23:04
February 19, 2018 23:04
February 19, 2018 23:04
February 19, 2018 23:04
February 19, 2018 23:04
February 19, 2018 23:04
February 19, 2018 23:04
February 19, 2018 23:04
February 19, 2018 23:04
November 30, 2017 10:42
January 14, 2020 14:14
January 10, 2019 17:51
October 8, 2019 11:17
November 17, 2020 17:37
November 17, 2020 17:37
February 19, 2018 23:04
April 7, 2018 21:40
November 13, 2020 15:58
March 26, 2020 14:46
February 24, 2018 22:04
February 19, 2018 23:04
February 14, 2018 14:06

Sourcegraph GoDoc Build Status codecov rcard License Gitter chat

A high-performance 100% compatible drop-in replacement of "encoding/json"

Benchmark

benchmark

Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go

Raw Result (easyjson requires static code generation)

ns/op allocation bytes allocation times
std decode 35510 ns/op 1960 B/op 99 allocs/op
easyjson decode 8499 ns/op 160 B/op 4 allocs/op
jsoniter decode 5623 ns/op 160 B/op 3 allocs/op
std encode 2213 ns/op 712 B/op 5 allocs/op
easyjson encode 883 ns/op 576 B/op 3 allocs/op
jsoniter encode 837 ns/op 384 B/op 4 allocs/op

Always benchmark with your own workload. The result depends heavily on the data input.

Usage

100% compatibility with standard lib

Replace

import "encoding/json"
json.Marshal(&data)

with

import jsoniter "github.com/json-iterator/go"

var json = jsoniter.ConfigCompatibleWithStandardLibrary
json.Marshal(&data)

Replace

import "encoding/json"
json.Unmarshal(input, &data)

with

import jsoniter "github.com/json-iterator/go"

var json = jsoniter.ConfigCompatibleWithStandardLibrary
json.Unmarshal(input, &data)

More documentation

How to get

go get github.com/json-iterator/go

Contribution Welcomed !

Contributors

Report issue or pull request, or email taowen@gmail.com, or Gitter chat