Nav apraksta

Tao Wen 48a4a1e4db consolidate map tests 7 gadi atpakaļ
api_tests 002b5ae342 fix tests 7 gadi atpakaļ
benchmarks 7990317be5 gofmt 7 gadi atpakaļ
extra b134d86290 optimize code 8 gadi atpakaļ
output_tests 48a4a1e4db consolidate map tests 7 gadi atpakaļ
skip_tests be6688fc1a fix #200, do not use symbolic link in the code 8 gadi atpakaļ
type_tests 48a4a1e4db consolidate map tests 7 gadi atpakaļ
.codecov.yml b74ffb2e03 import github.com/stretchr/testify/require 8 gadi atpakaļ
.gitignore 051434fab7 fix #198, use dep for vendoring 8 gadi atpakaļ
.travis.yml f29a0391bc travis: add 1.x to go versions 8 gadi atpakaļ
Gopkg.lock 051434fab7 fix #198, use dep for vendoring 8 gadi atpakaļ
Gopkg.toml 051434fab7 fix #198, use dep for vendoring 8 gadi atpakaļ
LICENSE 923358c07e Initial commit 9 gadi atpakaļ
README.md bca911dae0 Update README.md 7 gadi atpakaļ
build.sh 051434fab7 fix #198, use dep for vendoring 8 gadi atpakaļ
compatible_test.go 640251ab91 Fix standard compatiblility 8 gadi atpakaļ
example_test.go 9ecb1fd36d fix go vet 8 gadi atpakaļ
feature_adapter.go 71f74dc71e implement #230 DisallowUnknownFields option added 7 gadi atpakaļ
feature_any.go b1b003864e expose OptionalEncoder&OptionalDecoder; add attachment to Stream&Iterator for customized decoder/encoder 8 gadi atpakaļ
feature_any_array.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_bool.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_float.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_int32.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_int64.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_invalid.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_nil.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_number.go 7990317be5 gofmt 7 gadi atpakaļ
feature_any_object.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_string.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_uint32.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_any_uint64.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
feature_config.go 71f74dc71e implement #230 DisallowUnknownFields option added 7 gadi atpakaļ
feature_config_with_sync_map.go 07f99a1124 fix build 7 gadi atpakaļ
feature_config_without_sync_map.go 71f74dc71e implement #230 DisallowUnknownFields option added 7 gadi atpakaļ
feature_iter.go 9f088cbcc4 fix #195 when decode float as int, report it clearly 8 gadi atpakaļ
feature_iter_array.go 6240e1e798 #185 add jsoniter.Valid 8 gadi atpakaļ
feature_iter_float.go 25f147f530 add ReadNumber for Iterator. 8 gadi atpakaļ
feature_iter_int.go 13f86432b8 do not use defer() in read int 8 gadi atpakaļ
feature_iter_object.go f1258b01aa fix #191 do not always assume the object field is simple string 8 gadi atpakaļ
feature_iter_skip.go 6240e1e798 #185 add jsoniter.Valid 8 gadi atpakaļ
feature_iter_skip_sloppy.go 7e3b776024 change jsoniter-sloppy to jsoniter_sloppy 8 gadi atpakaļ
feature_iter_skip_strict.go 7e3b776024 change jsoniter-sloppy to jsoniter_sloppy 8 gadi atpakaļ
feature_iter_string.go 6240e1e798 #185 add jsoniter.Valid 8 gadi atpakaļ
feature_json_number.go 73c7bc881e fix #180, add missing methods to jsoniter.Number 8 gadi atpakaļ
feature_pool.go b1b003864e expose OptionalEncoder&OptionalDecoder; add attachment to Stream&Iterator for customized decoder/encoder 8 gadi atpakaļ
feature_reflect.go a9b9c73b4d fix #207 delay unsupported type error reporting 8 gadi atpakaļ
feature_reflect_array.go 807e4a8b20 Optimize 0-length array case 7 gadi atpakaļ
feature_reflect_extension.go c27f6f9350 config: add OnlyTaggedField config, only process tagged fields in struct 8 gadi atpakaļ
feature_reflect_map.go 945d1aaa19 fix #140 uintptr will no lock the address from gc 7 gadi atpakaļ
feature_reflect_native.go c39a632e65 fix #227, fix empty json.Number 7 gadi atpakaļ
feature_reflect_object.go 71f74dc71e implement #230 DisallowUnknownFields option added 7 gadi atpakaļ
feature_reflect_optional.go 0ab880662f fix #219 should check real value for empty instead of just the pointer for nested field 8 gadi atpakaļ
feature_reflect_slice.go 945d1aaa19 fix #140 uintptr will no lock the address from gc 7 gadi atpakaļ
feature_reflect_struct_decoder.go 71f74dc71e implement #230 DisallowUnknownFields option added 7 gadi atpakaļ
feature_stream.go b1b003864e expose OptionalEncoder&OptionalDecoder; add attachment to Stream&Iterator for customized decoder/encoder 8 gadi atpakaļ
feature_stream_float.go bede1d7f40 fix build; add document for exported symbols 8 gadi atpakaļ
feature_stream_int.go bede1d7f40 fix build; add document for exported symbols 8 gadi atpakaļ
feature_stream_string.go 36b14963da #153 fix invalid utf8 using same implementation as the standard library 8 gadi atpakaļ
fuzzy_mode_convert_table.md 779c3e2164 update conversion table 8 gadi atpakaļ
jsoniter.go f0487718f6 document public symbols 8 gadi atpakaļ
jsoniter_1dot8_only_test.go f1258b01aa fix #191 do not always assume the object field is simple string 8 gadi atpakaļ
jsoniter_adapter_test.go 845d8438db #126 fix space in case map key is sorted 8 gadi atpakaļ
jsoniter_alias_test.go bede1d7f40 fix build; add document for exported symbols 8 gadi atpakaļ
jsoniter_any_array_test.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
jsoniter_any_bool_test.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
jsoniter_any_float_test.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
jsoniter_any_int_test.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
jsoniter_any_map_test.go b74ffb2e03 import github.com/stretchr/testify/require 8 gadi atpakaļ
jsoniter_any_null_test.go b74ffb2e03 import github.com/stretchr/testify/require 8 gadi atpakaļ
jsoniter_any_object_test.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
jsoniter_any_string_test.go ea8c33040f fix #228 7 gadi atpakaļ
jsoniter_array_test.go c15b4d116c #139 unmarshal non base64 into []byte 8 gadi atpakaļ
jsoniter_bool_test.go b5d2607a6d replace should.Equal(nil, err) with should.NoError(err) 8 gadi atpakaļ
jsoniter_customize_test.go a9b9c73b4d fix #207 delay unsupported type error reporting 8 gadi atpakaļ
jsoniter_demo_test.go 6d0e6f3733 fix go report card 8 gadi atpakaļ
jsoniter_encode_interface_test.go 93ce14316d increase coverage 8 gadi atpakaļ
jsoniter_enum_marshaler_test.go b5d2607a6d replace should.Equal(nil, err) with should.NoError(err) 8 gadi atpakaļ
jsoniter_fixed_array_test.go ba3857729b Fix encoding 0-length arrays 7 gadi atpakaļ
jsoniter_float_test.go 25f147f530 add ReadNumber for Iterator. 8 gadi atpakaļ
jsoniter_int_test.go c39a632e65 fix #227, fix empty json.Number 7 gadi atpakaļ
jsoniter_interface_test.go 6dad2de6cc fix build 8 gadi atpakaļ
jsoniter_invalid_test.go 11c1cce0d8 fix #217 when input is null, non-decodable type should not be considered as error, to be compatible with stdlib 8 gadi atpakaļ
jsoniter_io_test.go f6da8e62c3 #133 validate json when Skip() 8 gadi atpakaļ
jsoniter_iterator_test.go be9d4ded4f Use json.Number as the return 8 gadi atpakaļ
jsoniter_large_file_test.go c15b4d116c #139 unmarshal non base64 into []byte 8 gadi atpakaļ
jsoniter_map_test.go bd4364ab7c #129 fix read map with reader, should use ReadMapCB instead of ReadObjectCB 8 gadi atpakaļ
jsoniter_must_be_valid_test.go b74ffb2e03 import github.com/stretchr/testify/require 8 gadi atpakaļ
jsoniter_nested_test.go 818ae1331a #68 number to string 8 gadi atpakaļ
jsoniter_null_test.go 9f6e5962a9 Improve stdlib compatibility 8 gadi atpakaļ
jsoniter_object_test.go 7990317be5 gofmt 7 gadi atpakaļ
jsoniter_optional_test.go b74ffb2e03 import github.com/stretchr/testify/require 8 gadi atpakaļ
jsoniter_raw_message_test.go 46b20bbbec #178 SkipAndReturnBytes should return copy of memory 8 gadi atpakaļ
jsoniter_reader_test.go 9b3ec40fd9 #133 fix empty struct skip; fix ] as empty array 8 gadi atpakaļ
jsoniter_reflect_native_test.go b31b1301e2 #59 add ConfigFastest 8 gadi atpakaļ
jsoniter_skip_test.go aed5a81f09 fix #190 handle empty input 8 gadi atpakaļ
jsoniter_sloppy_test.go 5eded4f6ae implement skip number and string strictly 8 gadi atpakaļ
jsoniter_stream_test.go dbb1ef3f63 #177 flush buffer should check available again 8 gadi atpakaļ
jsoniter_string_test.go 156284b028 #137 fix unicode surrogate incompatibility 8 gadi atpakaļ
jsoniter_struct_decoder_test.go 2dc0031b26 #152 gofmt 8 gadi atpakaļ
jsoniter_struct_encoder_test.go 1f58120d43 Always skip unexported fields when encoding 8 gadi atpakaļ
jsoniter_wrap_test.go d249b05a85 rename ValueType, to avoid collision with json.Number 8 gadi atpakaļ
test.sh b46d0a2324 make test faster 8 gadi atpakaļ
unmarshal_input_test.go f6da8e62c3 #133 validate json when Skip() 8 gadi atpakaļ

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