1
0
mirror of https://github.com/json-iterator/go.git synced 2024-12-09 08:55:35 +02:00
A high-performance 100% compatible drop-in replacement of "encoding/json" http://jsoniter.com/migrate-from-go-std.html
Go to file
2018-02-20 23:04:04 +08:00
any_tests consolidate more tests 2018-02-14 10:13:34 +08:00
api_tests consolidate mor tests 2018-02-13 23:49:40 +08:00
benchmarks consolidate more tests 2018-02-14 08:28:17 +08:00
extension_tests remove EncodeInterface 2018-02-14 15:04:23 +08:00
extra remove EncodeInterface 2018-02-14 15:04:23 +08:00
misc_tests consolidate more tests 2018-02-14 10:13:34 +08:00
skip_tests consolidate more tests 2018-02-14 10:13:34 +08:00
type_tests use reflect2 decode slice 2018-02-19 14:18:42 +08:00
value_tests use reflect2 to implement map decoder 2018-02-19 22:53:42 +08:00
.codecov.yml import github.com/stretchr/testify/require 2017-07-07 09:13:25 +08:00
.gitignore fix #198, use dep for vendoring 2017-11-30 10:42:24 +08:00
.travis.yml travis: add 1.x to go versions 2017-09-07 17:12:42 +02:00
adapter.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_array.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_bool.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_float.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_int32.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_int64.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_invalid.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_nil.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_number.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_object.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_str.go rename 2018-02-19 23:08:01 +08:00
any_uint32.go remove feature prefix 2018-02-19 23:04:25 +08:00
any_uint64.go remove feature prefix 2018-02-19 23:04:25 +08:00
any.go move any codec 2018-02-20 23:04:04 +08:00
build.sh fix #198, use dep for vendoring 2017-11-30 10:42:24 +08:00
config_with_sync_map.go remove feature prefix 2018-02-19 23:04:25 +08:00
config_without_sync_map.go remove feature prefix 2018-02-19 23:04:25 +08:00
config.go remove feature prefix 2018-02-19 23:04:25 +08:00
example_test.go fix go vet 2017-07-09 11:24:26 +08:00
fuzzy_mode_convert_table.md update conversion table 2017-07-13 00:13:04 +08:00
Gopkg.lock fix #198, use dep for vendoring 2017-11-30 10:42:24 +08:00
Gopkg.toml fix #198, use dep for vendoring 2017-11-30 10:42:24 +08:00
iter_array.go remove feature prefix 2018-02-19 23:04:25 +08:00
iter_float.go remove feature prefix 2018-02-19 23:04:25 +08:00
iter_int.go remove feature prefix 2018-02-19 23:04:25 +08:00
iter_object.go remove feature prefix 2018-02-19 23:04:25 +08:00
iter_skip_sloppy_test.go remove feature prefix 2018-02-19 23:04:25 +08:00
iter_skip_sloppy.go remove feature prefix 2018-02-19 23:04:25 +08:00
iter_skip_strict.go remove feature prefix 2018-02-19 23:04:25 +08:00
iter_skip.go remove feature prefix 2018-02-19 23:04:25 +08:00
iter_str.go remove feature prefix 2018-02-19 23:04:25 +08:00
iter.go remove feature prefix 2018-02-19 23:04:25 +08:00
jsoniter.go document public symbols 2017-07-09 16:09:23 +08:00
LICENSE Initial commit 2016-11-30 08:30:24 +08:00
pool.go remove feature prefix 2018-02-19 23:04:25 +08:00
README.md Update README.md 2018-01-28 22:27:09 +08:00
reflect_array.go remove feature prefix 2018-02-19 23:04:25 +08:00
reflect_extension.go remove feature prefix 2018-02-19 23:04:25 +08:00
reflect_json_number.go move json number impl 2018-02-19 23:13:33 +08:00
reflect_json_raw_message.go move json raw message 2018-02-20 22:38:35 +08:00
reflect_map.go remove feature prefix 2018-02-19 23:04:25 +08:00
reflect_marshaler.go remove feature prefix 2018-02-19 23:04:25 +08:00
reflect_native.go move encoder/decoder of native 2018-02-20 22:55:31 +08:00
reflect_optional.go remove feature prefix 2018-02-19 23:04:25 +08:00
reflect_slice.go remove feature prefix 2018-02-19 23:04:25 +08:00
reflect_struct_decoder.go move json raw message 2018-02-20 22:38:35 +08:00
reflect_struct_encoder.go move json raw message 2018-02-20 22:38:35 +08:00
reflect.go move any codec 2018-02-20 23:04:04 +08:00
stream_float.go remove feature prefix 2018-02-19 23:04:25 +08:00
stream_int.go remove feature prefix 2018-02-19 23:04:25 +08:00
stream_str.go remove feature prefix 2018-02-19 23:04:25 +08:00
stream_test.go remove feature prefix 2018-02-19 23:04:25 +08:00
stream.go remove feature prefix 2018-02-19 23:04:25 +08:00
test.sh fix coverage 2018-02-14 14:06:32 +08:00

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

Go开发者们请加入我们,滴滴出行平台技术部 taowen@didichuxing.com

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

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