Sin descripción

Tao Wen 2074f25bd3 use extension to implement EscapeHtml config option hace 7 años
any_tests 477be43d00 consolidate more tests hace 7 años
api_tests 8fa357ab7b consolidate mor tests hace 7 años
benchmarks e3bc511e5a consolidate more tests hace 7 años
extension_tests 0e2b54800a remove EncodeInterface hace 7 años
extra 0e2b54800a remove EncodeInterface hace 7 años
misc_tests 477be43d00 consolidate more tests hace 7 años
skip_tests 477be43d00 consolidate more tests hace 7 años
type_tests ef3038593b check nil for interface{} hace 7 años
value_tests 9dafbc667f when embedded ptr is nil, the fields should be omitted hace 7 años
.codecov.yml b74ffb2e03 import github.com/stretchr/testify/require hace 8 años
.gitignore 051434fab7 fix #198, use dep for vendoring hace 8 años
.travis.yml f29a0391bc travis: add 1.x to go versions hace 8 años
Gopkg.lock 051434fab7 fix #198, use dep for vendoring hace 8 años
Gopkg.toml 051434fab7 fix #198, use dep for vendoring hace 8 años
LICENSE 923358c07e Initial commit hace 9 años
README.md bca911dae0 Update README.md hace 7 años
build.sh 051434fab7 fix #198, use dep for vendoring hace 8 años
example_test.go 9ecb1fd36d fix go vet hace 8 años
feature_adapter.go 71f74dc71e implement #230 DisallowUnknownFields option added hace 7 años
feature_any.go 0e2b54800a remove EncodeInterface hace 7 años
feature_any_array.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_bool.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_float.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_int32.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_int64.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_invalid.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_nil.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_number.go 7990317be5 gofmt hace 7 años
feature_any_object.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_string.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_uint32.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_any_uint64.go d249b05a85 rename ValueType, to avoid collision with json.Number hace 8 años
feature_config.go 2074f25bd3 use extension to implement EscapeHtml config option hace 7 años
feature_config_with_sync_map.go 07f99a1124 fix build hace 7 años
feature_config_without_sync_map.go 71f74dc71e implement #230 DisallowUnknownFields option added hace 7 años
feature_iter.go 9f088cbcc4 fix #195 when decode float as int, report it clearly hace 8 años
feature_iter_array.go 6240e1e798 #185 add jsoniter.Valid hace 8 años
feature_iter_float.go 25f147f530 add ReadNumber for Iterator. hace 8 años
feature_iter_int.go 13f86432b8 do not use defer() in read int hace 8 años
feature_iter_object.go 24bb2eee9f fix #236 case sensitive when both upper case and lower case presents hace 7 años
feature_iter_skip.go 6240e1e798 #185 add jsoniter.Valid hace 8 años
feature_iter_skip_sloppy.go 7e3b776024 change jsoniter-sloppy to jsoniter_sloppy hace 8 años
feature_iter_skip_sloppy_test.go 477be43d00 consolidate more tests hace 7 años
feature_iter_skip_strict.go 7e3b776024 change jsoniter-sloppy to jsoniter_sloppy hace 8 años
feature_iter_string.go 6240e1e798 #185 add jsoniter.Valid hace 8 años
feature_json_number.go 73c7bc881e fix #180, add missing methods to jsoniter.Number hace 8 años
feature_pool.go b1b003864e expose OptionalEncoder&OptionalDecoder; add attachment to Stream&Iterator for customized decoder/encoder hace 8 años
feature_reflect.go 9dafbc667f when embedded ptr is nil, the fields should be omitted hace 7 años
feature_reflect_array.go 0e2b54800a remove EncodeInterface hace 7 años
feature_reflect_extension.go 2074f25bd3 use extension to implement EscapeHtml config option hace 7 años
feature_reflect_map.go a7a34507ab use reflect2 for json.Marshaler hace 7 años
feature_reflect_native.go ef3038593b check nil for interface{} hace 7 años
feature_reflect_optional.go 9dafbc667f when embedded ptr is nil, the fields should be omitted hace 7 años
feature_reflect_slice.go 0e2b54800a remove EncodeInterface hace 7 años
feature_reflect_struct_decoder.go 24bb2eee9f fix #236 case sensitive when both upper case and lower case presents hace 7 años
feature_reflect_struct_encoder.go 9dafbc667f when embedded ptr is nil, the fields should be omitted hace 7 años
feature_stream.go 75810179f6 remove n from stream hace 7 años
feature_stream_float.go 75810179f6 remove n from stream hace 7 años
feature_stream_int.go 75810179f6 remove n from stream hace 7 años
feature_stream_string.go 75810179f6 remove n from stream hace 7 años
feature_stream_test.go 75810179f6 remove n from stream hace 7 años
fuzzy_mode_convert_table.md 779c3e2164 update conversion table hace 8 años
jsoniter.go f0487718f6 document public symbols hace 8 años
test.sh e7c7f3b337 fix coverage hace 7 años

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

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