Name Last Update
..
.codecov.yml Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
Gopkg.lock Loading commit data...
Gopkg.toml Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
adapter.go Loading commit data...
any.go Loading commit data...
any_array.go Loading commit data...
any_bool.go Loading commit data...
any_float.go Loading commit data...
any_int32.go Loading commit data...
any_int64.go Loading commit data...
any_invalid.go Loading commit data...
any_nil.go Loading commit data...
any_number.go Loading commit data...
any_object.go Loading commit data...
any_str.go Loading commit data...
any_uint32.go Loading commit data...
any_uint64.go Loading commit data...
build.sh Loading commit data...
config.go Loading commit data...
fuzzy_mode_convert_table.md Loading commit data...
iter.go Loading commit data...
iter_array.go Loading commit data...
iter_float.go Loading commit data...
iter_int.go Loading commit data...
iter_object.go Loading commit data...
iter_skip.go Loading commit data...
iter_skip_sloppy.go Loading commit data...
iter_skip_strict.go Loading commit data...
iter_str.go Loading commit data...
jsoniter.go Loading commit data...
pool.go Loading commit data...
reflect.go Loading commit data...
reflect_array.go Loading commit data...
reflect_dynamic.go Loading commit data...
reflect_extension.go Loading commit data...
reflect_json_number.go Loading commit data...
reflect_json_raw_message.go Loading commit data...
reflect_map.go Loading commit data...
reflect_marshaler.go Loading commit data...
reflect_native.go Loading commit data...
reflect_optional.go Loading commit data...
reflect_slice.go Loading commit data...
reflect_struct_decoder.go Loading commit data...
reflect_struct_encoder.go Loading commit data...
stream.go Loading commit data...
stream_float.go Loading commit data...
stream_int.go Loading commit data...
stream_str.go Loading commit data...
test.sh Loading commit data...

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