1
0
mirror of https://github.com/json-iterator/go.git synced 2024-11-27 08:30:57 +02:00
A high-performance 100% compatible drop-in replacement of "encoding/json" http://jsoniter.com/migrate-from-go-std.html
Go to file
2017-07-02 11:13:21 +08:00
assert gofmt 2017-06-06 23:27:00 +08:00
extra #71 fixed []byte alias 2017-06-26 14:25:56 +08:00
output_tests add test for uintptr 2017-07-01 10:57:42 -07:00
require fix 4 fields object decoding 2017-01-06 20:17:47 +08:00
.gitignore update ignore 2017-06-29 18:45:20 +08:00
example_test.go gofmt 2017-06-19 23:43:53 +08:00
feature_adapter.go #75 support MarshalIndent 2017-06-29 20:48:27 +08:00
feature_any_array.go gofmt 2017-06-19 23:43:53 +08:00
feature_any_bool.go add MustBeValid to Any 2017-06-19 21:21:20 +08:00
feature_any_float.go gofmt 2017-06-19 23:43:53 +08:00
feature_any_int32.go add MustBeValid to Any 2017-06-19 21:21:20 +08:00
feature_any_int64.go add MustBeValid to Any 2017-06-19 21:21:20 +08:00
feature_any_invalid.go add MustBeValid to Any 2017-06-19 21:21:20 +08:00
feature_any_nil.go add MustBeValid to Any 2017-06-19 21:21:20 +08:00
feature_any_number.go gofmt 2017-06-19 23:43:53 +08:00
feature_any_object.go gofmt 2017-06-19 23:43:53 +08:00
feature_any_string.go gofmt 2017-06-19 23:43:53 +08:00
feature_any_uint32.go add MustBeValid to Any 2017-06-19 21:21:20 +08:00
feature_any_uint64.go add MustBeValid to Any 2017-06-19 21:21:20 +08:00
feature_any.go gofmt 2017-06-19 23:43:53 +08:00
feature_config.go #75 support MarshalIndent 2017-06-29 20:48:27 +08:00
feature_iter_array.go #68 number to string 2017-06-20 15:11:01 +08:00
feature_iter_float.go #68 number to string 2017-06-20 15:11:01 +08:00
feature_iter_int.go fix anonymous fields 2017-06-21 00:26:18 +08:00
feature_iter_object.go #68 number to string 2017-06-20 15:11:01 +08:00
feature_iter_skip.go #68 number to string 2017-06-20 15:11:01 +08:00
feature_iter_string.go #68 number to string 2017-06-20 15:11:01 +08:00
feature_iter.go #68 string to int 2017-06-20 15:18:24 +08:00
feature_pool.go #61 removed internal buffer from lazy array and object; jsoniter.Get replaced jsoniter.UnmarshalAny 2017-06-18 22:22:13 +08:00
feature_reflect_array.go gofmt 2017-06-29 20:40:25 +08:00
feature_reflect_extension.go #93 fix omitempty within embedded struct 2017-07-01 09:27:48 +08:00
feature_reflect_map.go #76 support TextUnmarshal 2017-06-29 00:14:55 +08:00
feature_reflect_native.go #99 support uintptr 2017-07-02 11:03:13 +08:00
feature_reflect_object.go #95 struct and empty struct is considered as notempty 2017-07-01 11:48:17 +08:00
feature_reflect_slice.go #70 decode null to nil for map/slice 2017-06-26 10:20:49 +08:00
feature_reflect.go #101 checkIsEmpty can not reuse createEncoderOfSimpleType, otherwise it will fail when struct member is not serializable 2017-07-02 11:13:21 +08:00
feature_stream_float.go #53 move current config EnableXXX 2017-06-13 17:47:40 +08:00
feature_stream_int.go #53 move current config EnableXXX 2017-06-13 17:47:40 +08:00
feature_stream_string.go #63 keep struct field order 2017-06-23 08:21:02 +08:00
feature_stream.go #75 support MarshalIndent 2017-06-29 20:48:27 +08:00
jsoniter_adapter_test.go #75 support MarshalIndent 2017-06-29 20:48:27 +08:00
jsoniter_any_array_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_any_bool_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_any_float_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_any_int_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_any_map_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_any_null_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_any_object_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_any_string_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_array_test.go #63 add more tests for json.RawMessage 2017-06-19 21:24:59 +08:00
jsoniter_bool_test.go extract out any tests 2017-06-17 21:32:48 +08:00
jsoniter_customize_test.go #101 checkIsEmpty can not reuse createEncoderOfSimpleType, otherwise it will fail when struct member is not serializable 2017-07-02 11:13:21 +08:00
jsoniter_demo_test.go #59 add ConfigFastest 2017-06-17 10:21:37 +08:00
jsoniter_find_end_test.go #59 add ConfigFastest 2017-06-17 10:21:37 +08:00
jsoniter_fixed_array_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_float_test.go fix lossy float marshal and omit empty 2017-06-20 07:51:38 +08:00
jsoniter_int_test.go extract out any tests 2017-06-17 21:32:48 +08:00
jsoniter_interface_test.go #91 fix one ptr embedded struct 2017-07-01 00:09:40 +08:00
jsoniter_io_test.go #59 add ConfigFastest 2017-06-17 10:21:37 +08:00
jsoniter_iterator_test.go extract out any tests 2017-06-17 21:32:48 +08:00
jsoniter_large_file_test.go #59 add ConfigFastest 2017-06-17 10:21:37 +08:00
jsoniter_map_test.go fix anonymous fields 2017-06-21 00:26:18 +08:00
jsoniter_nested_test.go #68 number to string 2017-06-20 15:11:01 +08:00
jsoniter_null_test.go #70 decode null to nil for map/slice 2017-06-26 10:20:49 +08:00
jsoniter_object_test.go #87 fix embedded field sorting order 2017-06-30 14:01:50 +08:00
jsoniter_optional_test.go #53 move current config EnableXXX 2017-06-13 17:47:40 +08:00
jsoniter_raw_message_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_reflect_native_test.go #59 add ConfigFastest 2017-06-17 10:21:37 +08:00
jsoniter_skip_test.go gofmt 2017-06-19 23:43:53 +08:00
jsoniter_stream_test.go #59 add ConfigFastest 2017-06-17 10:21:37 +08:00
jsoniter_string_test.go #71 fix html escape for string alias 2017-06-26 09:57:45 +08:00
LICENSE Initial commit 2016-11-30 08:30:24 +08:00
README.md update value proposition 2017-06-26 14:28:03 +08:00

rcard

A high-performance 100% compatible drop-in replacement of "encoding/json"

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"
jsoniter.Marshal(&data)

Replace

import "encoding/json"
json.Unmarshal(input, &data)

with

import "github.com/json-iterator/go"
jsoniter.Unmarshal(input, &data)

More documentation

How to get

go get github.com/json-iterator/go

Contribution Welcomed !

Report issue or pull request, or email taowen@gmail.com, or Gitter chat