Aucune description

Tao Wen acfec88f7a Merge pull request #422 from JensErat/map-invalid-type il y a 6 ans
any_tests 05d041de10 fix #313 support json marshaller type as map key il y a 7 ans
api_tests 7c9f8c2d20 Revert "Merge pull request #418 from bbrks/configurable_maxDepth" il y a 6 ans
benchmarks fff342fd04 gofmt il y a 7 ans
extension_tests aba8654400 fix nil attachment on stream in custom encoder on sorted map il y a 6 ans
extra c5ddac9dc3 simplify `x = x <op> y` to `x <op>= y` il y a 7 ans
misc_tests eec24895fe Limit nesting depth il y a 6 ans
skip_tests 459f0e30ae fix #37: add SkipAndAppendBytes iterator method il y a 6 ans
type_tests 83f7b825b3 Unnamed struct literals il y a 6 ans
value_tests a1c9557592 pass nested error in compatible configuration il y a 6 ans
.codecov.yml b74ffb2e03 import github.com/stretchr/testify/require il y a 8 ans
.gitignore 051434fab7 fix #198, use dep for vendoring il y a 8 ans
.travis.yml f29a0391bc travis: add 1.x to go versions il y a 8 ans
Gopkg.lock 720ab8dc7f add tests for #283 il y a 7 ans
Gopkg.toml 720ab8dc7f add tests for #283 il y a 7 ans
LICENSE 923358c07e Initial commit il y a 9 ans
README.md 0ff49de124 update README il y a 6 ans
adapter.go 0fd91468bb Fix typo in UnmarshalFromString documentation il y a 6 ans
any.go 5916df66b3 fix #311 handle nil any il y a 7 ans
any_array.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_bool.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_float.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_int32.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_int64.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_invalid.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_nil.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_number.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_object.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_str.go c99d73acd0 rename il y a 7 ans
any_uint32.go 3d39af6dd9 remove feature prefix il y a 7 ans
any_uint64.go 3d39af6dd9 remove feature prefix il y a 7 ans
build.sh 051434fab7 fix #198, use dep for vendoring il y a 8 ans
config.go 7c9f8c2d20 Revert "Merge pull request #418 from bbrks/configurable_maxDepth" il y a 6 ans
example_test.go ae4c002f78 rename ExampleMyKey il y a 7 ans
fuzzy_mode_convert_table.md 779c3e2164 update conversion table il y a 8 ans
go.mod 24c3d57281 Add go module definition il y a 6 ans
go.sum 24c3d57281 Add go module definition il y a 6 ans
iter.go 7c9f8c2d20 Revert "Merge pull request #418 from bbrks/configurable_maxDepth" il y a 6 ans
iter_array.go eec24895fe Limit nesting depth il y a 6 ans
iter_float.go 3a023a5fbc clean readPositiveFloat64 il y a 7 ans
iter_int.go ebe943a4a6 fix #241, support 32bit platform il y a 7 ans
iter_object.go eec24895fe Limit nesting depth il y a 6 ans
iter_skip.go 459f0e30ae fix #37: add SkipAndAppendBytes iterator method il y a 6 ans
iter_skip_sloppy.go eec24895fe Limit nesting depth il y a 6 ans
iter_skip_sloppy_test.go 3d39af6dd9 remove feature prefix il y a 7 ans
iter_skip_strict.go d05f387f50 fix #317, try parse as BigFloat if overflow il y a 7 ans
iter_str.go 3d39af6dd9 remove feature prefix il y a 7 ans
jsoniter.go f0487718f6 document public symbols il y a 8 ans
pool.go b858ec296c Release writer to enable GC il y a 7 ans
reflect.go eec24895fe Limit nesting depth il y a 6 ans
reflect_array.go 455b3f8bb8 move reflect2 from plz to modern-go il y a 7 ans
reflect_dynamic.go 455b3f8bb8 move reflect2 from plz to modern-go il y a 7 ans
reflect_extension.go 83f7b825b3 Unnamed struct literals il y a 6 ans
reflect_json_number.go 455b3f8bb8 move reflect2 from plz to modern-go il y a 7 ans
reflect_json_raw_message.go 455b3f8bb8 move reflect2 from plz to modern-go il y a 7 ans
reflect_map.go acfec88f7a Merge pull request #422 from JensErat/map-invalid-type il y a 6 ans
reflect_marshaler.go 976454858b use json.Marshaler then trim the last '\n' in reflect_marshaler il y a 6 ans
reflect_native.go fb5614a4ca Don't marshal empty byte or uint8 slice as null il y a 6 ans
reflect_optional.go 455b3f8bb8 move reflect2 from plz to modern-go il y a 7 ans
reflect_slice.go 455b3f8bb8 move reflect2 from plz to modern-go il y a 7 ans
reflect_struct_decoder.go eec24895fe Limit nesting depth il y a 6 ans
reflect_struct_encoder.go aba8654400 fix nil attachment on stream in custom encoder on sorted map il y a 6 ans
stream.go 2a93f9003e fix #244 use BinaryAsStringExtension to make []byte pretty, while the output is valid json, but it can not be decoded by other json codec, as \x01 is decoded as \x01 by them, which is not original input il y a 7 ans
stream_float.go 08047c174c fix #365, return error for +inf -inf and NaN il y a 6 ans
stream_int.go fff342fd04 gofmt il y a 7 ans
stream_str.go 3d39af6dd9 remove feature prefix il y a 7 ans
stream_test.go 3d39af6dd9 remove feature prefix il y a 7 ans
test.sh e7c7f3b337 fix coverage il y a 7 ans

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