forked from mirror/go-json
e58b1eabaf
There're some problem with current usage of reflect.SliceHeader. First, it violates the unsafe pointer conversion (rule 6th), that said, reflect.SliceHeader must not used as plain struct. Second, the lowest version that go-json supports, go1.12, reflect package did not use SliceHeader in typedslicecopy, but use the safety version. There's no reason that go-json continue using them. See: - https://golang.org/pkg/unsafe/#Pointer - https://github.com/golang/go/blob/release-branch.go1.12/src/reflect/value.go#L2702 |
||
---|---|---|
.github/workflows | ||
benchmarks | ||
cmd/generator | ||
LICENSE | ||
README.md | ||
compact.go | ||
decode.go | ||
decode_array.go | ||
decode_bool.go | ||
decode_compile.go | ||
decode_context.go | ||
decode_float.go | ||
decode_int.go | ||
decode_interface.go | ||
decode_map.go | ||
decode_number.go | ||
decode_ptr.go | ||
decode_slice.go | ||
decode_stream.go | ||
decode_string.go | ||
decode_struct.go | ||
decode_test.go | ||
decode_uint.go | ||
decode_unmarshal_json.go | ||
decode_unmarshal_text.go | ||
decode_wrapped_string.go | ||
encode.go | ||
encode_compile.go | ||
encode_context.go | ||
encode_map112.go | ||
encode_map113.go | ||
encode_opcode.go | ||
encode_optype.go | ||
encode_string.go | ||
encode_test.go | ||
encode_vm.go | ||
error.go | ||
example_marshaling_test.go | ||
example_test.go | ||
example_text_marshaling_test.go | ||
export_test.go | ||
go.mod | ||
go.sum | ||
helper_test.go | ||
indent.go | ||
json.go | ||
json_test.go | ||
number_test.go | ||
option.go | ||
rtype.go | ||
stream_test.go | ||
struct_field.go | ||
tagkey_test.go |
README.md
go-json
Fast JSON encoder/decoder compatible with encoding/json for Go
Installation
go get github.com/goccy/go-json
How to use
Replace import statement from encoding/json
to github.com/goccy/go-json
-import "encoding/json"
+import "github.com/goccy/go-json"
Benchmarks
$ cd benchmarks
$ go test -bench .
Encode
Fastest
SmallStruct
MediumStruct
LargeStruct
Decode
So faster than json-iterator/go
json.Unmarshal
SmallStruct
MediumStruct
LargeStruct
Stream Decode
SmallStruct
MediumStruct
LargeStruct
Status
Type
Currently supported all types
API
Implements All APIs
Error
InvalidUTF8Error
InvalidUnmarshalError
MarshalerError
SyntaxError
UnmarshalFieldError
UnmarshalTypeError
UnsupportedTypeError
UnsupportedValueError
License
MIT