Fast JSON encoder/decoder compatible with encoding/json for Go
Go to file
Masaaki Goshima 9e97505584 Remove sync.Pool for encodeRuntimeContext 2020-12-20 20:09:41 +09:00
.github/workflows Fix env settings 2020-11-19 02:26:56 +09:00
benchmarks Add github.com/segmentio/encoding/json to benchmark 2020-12-20 03:57:24 +09:00
cmd/generator Fix recursive anonymous field 2020-11-16 21:28:33 +09:00
LICENSE Initial commit 2020-04-19 18:32:37 +09:00
README.md Update README.md 2020-09-09 17:11:28 +09:00
compact.go Fix MarshalJSON/MarshalText 2020-08-18 13:36:36 +09:00
decode.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_array.go Pass expression to unsafe.Pointer directly 2020-11-23 14:13:45 +09:00
decode_bool.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_compile.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_context.go Add benchmark for medium struct 2020-07-31 20:24:39 +09:00
decode_float.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_int.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_interface.go Remove dummy field for keeping reference of pointer 2020-11-19 12:54:43 +09:00
decode_map.go Remove dummy field for keeping reference of pointer 2020-11-19 12:54:43 +09:00
decode_number.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_ptr.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_slice.go Pass expression to unsafe.Pointer directly 2020-11-23 14:13:45 +09:00
decode_stream.go Refactor 2020-08-14 18:26:42 +09:00
decode_string.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_struct.go Pass expression to unsafe.Pointer directly 2020-11-23 14:13:45 +09:00
decode_test.go Fix recursive anonymous field 2020-11-16 21:28:33 +09:00
decode_uint.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_unmarshal_json.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_unmarshal_text.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
decode_wrapped_string.go Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
encode.go Remove sync.Pool for encodeRuntimeContext 2020-12-20 20:09:41 +09:00
encode_compile.go Refactor buffering of encoder for improvement performance 2020-12-20 04:02:03 +09:00
encode_context.go Remove sync.Pool for encodeRuntimeContext 2020-12-20 20:09:41 +09:00
encode_int.go Replace int/uint encoding implementation 2020-12-20 04:02:03 +09:00
encode_map112.go Fix build 2020-04-26 12:49:54 +09:00
encode_map113.go Fix build 2020-04-26 12:49:54 +09:00
encode_opcode.go Change uintptrSize to constant 2020-12-09 19:20:51 +09:00
encode_optype.go Fix recursive anonymous field 2020-11-16 21:28:33 +09:00
encode_string.go Expand source for string encoding 2020-12-20 04:02:03 +09:00
encode_test.go Enable switch map processing at runtime 2020-09-16 18:15:47 +09:00
encode_vm.go Fix initialize seenPtr 2020-12-20 19:08:20 +09:00
error.go Add test cases for MarshalJSON and MarshalText 2020-08-19 00:32:45 +09:00
example_marshaling_test.go Add examples 2020-08-27 21:02:44 +09:00
example_test.go Omit map example because currently cannot sort map by keys 2020-08-27 21:13:36 +09:00
example_text_marshaling_test.go Fix pointer fields 2020-09-17 21:50:27 +09:00
export_test.go Add test cases for MarshalJSON and MarshalText 2020-08-19 00:32:45 +09:00
go.mod Removed dependency on xerrors 2020-05-09 01:49:37 +09:00
go.sum Removed dependency on xerrors 2020-05-09 01:49:37 +09:00
helper_test.go Fix null value for struct field 2020-08-08 13:20:42 +09:00
indent.go Fix encoding for Indent/MarshalIndent 2020-08-27 21:01:53 +09:00
json.go Refactor buffering of encoder for improvement performance 2020-12-20 04:02:03 +09:00
json_test.go Fix test case 2020-11-18 16:47:50 +09:00
number_test.go Add test cases 2020-08-25 00:56:23 +09:00
option.go Add option.go 2020-09-16 18:23:43 +09:00
rtype.go Fix MarshalJSON/MarshalText 2020-08-18 13:36:36 +09:00
stream_test.go Fix stream encoding 2020-09-17 01:26:39 +09:00
struct_field.go Fix stream encoding 2020-09-17 01:26:39 +09:00
tagkey_test.go Fix test case 2020-09-17 10:53:39 +09:00

README.md

go-json

Go GoDoc

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