Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
A high-performance 100% compatible drop-in replacement of "encoding/json"
Branch: master
Clone or download
Latest commit 0ff49de Mar 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
any_tests fix #313 support json marshaller type as map key Oct 24, 2018
api_tests Merge pull request #316 from proemergotech/master Feb 8, 2019
benchmarks gofmt Feb 24, 2018
extension_tests
extra simplify `x = x <op> y` to `x <op>= y` Sep 13, 2018
misc_tests
skip_tests fix #313 support json marshaller type as map key Oct 24, 2018
type_tests
value_tests fix #317, try parse as BigFloat if overflow Nov 12, 2018
.codecov.yml
.gitignore fix #198, use dep for vendoring Nov 30, 2017
.travis.yml
Gopkg.lock add tests for #283 Jul 1, 2018
Gopkg.toml
LICENSE
README.md
adapter.go
any.go fix #311 handle nil any Oct 24, 2018
any_array.go remove feature prefix Feb 19, 2018
any_bool.go remove feature prefix Feb 19, 2018
any_float.go remove feature prefix Feb 19, 2018
any_int32.go remove feature prefix Feb 19, 2018
any_int64.go remove feature prefix Feb 19, 2018
any_invalid.go
any_nil.go remove feature prefix Feb 19, 2018
any_number.go
any_object.go
any_str.go
any_uint32.go
any_uint64.go remove feature prefix Feb 19, 2018
build.sh fix #198, use dep for vendoring Nov 30, 2017
config.go
example_test.go
fuzzy_mode_convert_table.md update conversion table Jul 12, 2017
iter.go
iter_array.go remove feature prefix Feb 19, 2018
iter_float.go clean readPositiveFloat64 Jan 10, 2019
iter_int.go fix #241, support 32bit platform Feb 23, 2018
iter_object.go
iter_skip.go remove feature prefix Feb 19, 2018
iter_skip_sloppy.go
iter_skip_sloppy_test.go remove feature prefix Feb 19, 2018
iter_skip_strict.go
iter_str.go remove feature prefix Feb 19, 2018
jsoniter.go document public symbols Jul 9, 2017
pool.go Release writer to enable GC Apr 7, 2018
reflect.go
reflect_array.go move reflect2 from plz to modern-go Feb 28, 2018
reflect_dynamic.go
reflect_extension.go fix #308 do NOT skip embedded structs without tag when OnlyTaggedFiel… Oct 29, 2018
reflect_json_number.go
reflect_json_raw_message.go move reflect2 from plz to modern-go Feb 28, 2018
reflect_map.go fix #313 support json marshaller type as map key Oct 24, 2018
reflect_marshaler.go Fix the incompatible encoding Jan 3, 2019
reflect_native.go
reflect_optional.go
reflect_slice.go
reflect_struct_decoder.go Fix case sensitivity for nested fields Jun 12, 2018
reflect_struct_encoder.go move reflect2 from plz to modern-go Feb 28, 2018
stream.go
stream_float.go
stream_int.go
stream_str.go
stream_test.go
test.sh

README.md

Sourcegraph GoDoc Build Status codecov rcard License Gitter chat

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

You can also use thrift like JSON using thrift-iterator

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 "github.com/json-iterator/go"

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

Replace

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

with

import "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

You can’t perform that action at this time.