Fast JSON encoder/decoder compatible with encoding/json for Go
Go to file
Masaaki Goshima 2ddd2d882e Add examples 2020-08-27 21:02:44 +09:00
.github/workflows Create go.yml 2020-04-26 12:11:35 +09:00
benchmarks Add benchmark for large struct 2020-07-31 20:28:04 +09:00
cmd/generator Add new operation 2020-08-24 01:48:52 +09:00
LICENSE Initial commit 2020-04-19 18:32:37 +09:00
README.md Add Compact/Indent/HTMLEscape/Valid 2020-08-12 16:54:15 +09:00
compact.go Fix MarshalJSON/MarshalText 2020-08-18 13:36:36 +09:00
decode.go Fix decoding of recursive type 2020-08-25 17:18:37 +09:00
decode_array.go Fix DisallowUnknownFields 2020-08-14 17:59:49 +09:00
decode_bool.go Fix Compact 2020-08-14 18:18:32 +09:00
decode_compile.go Fix decoding of recursive type 2020-08-25 17:18:37 +09:00
decode_context.go Add benchmark for medium struct 2020-07-31 20:24:39 +09:00
decode_float.go Add validation for decode_float 2020-08-25 00:56:01 +09:00
decode_int.go Fix DisallowUnknownFields 2020-08-14 17:59:49 +09:00
decode_interface.go Refactor 2020-08-25 11:18:01 +09:00
decode_map.go Fix typo 2020-08-14 18:18:32 +09:00
decode_number.go Fix DisallowUnknownFields 2020-08-14 17:59:49 +09:00
decode_ptr.go Fix DisallowUnknownFields 2020-08-14 17:59:49 +09:00
decode_slice.go Fix DisallowUnknownFields 2020-08-14 17:59:49 +09:00
decode_stream.go Refactor 2020-08-14 18:26:42 +09:00
decode_string.go Fix decoder for string tag 2020-08-20 12:38:50 +09:00
decode_struct.go Fix DisallowUnknownFields 2020-08-14 17:59:49 +09:00
decode_test.go Fix map key type 2020-08-25 11:17:38 +09:00
decode_uint.go Fix DisallowUnknownFields 2020-08-14 17:59:49 +09:00
decode_unmarshal_json.go Fix DisallowUnknownFields 2020-08-14 17:59:49 +09:00
decode_unmarshal_text.go Copy unquoteBytes from encoding/json and use it for UnmarshalText 2020-08-27 21:00:49 +09:00
decode_wrapped_string.go Fix decoder for string tag 2020-08-20 12:38:50 +09:00
encode.go Add validation for null value 2020-08-21 11:07:55 +09:00
encode_compile.go Add special operation for opStructFieldHead and opStructField 2020-08-24 01:50:18 +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 Fix dump format 2020-08-22 18:13:44 +09:00
encode_optype.go Add new operation 2020-08-24 01:48:52 +09:00
encode_string.go Refactor encodeEscapedString ( for improvement performance ) 2020-08-15 23:11:06 +09:00
encode_test.go Add test case 2020-08-23 00:53:08 +09:00
encode_vm.go Fix encoding for Indent/MarshalIndent 2020-08-27 21:01:53 +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 Add examples 2020-08-27 21:02:44 +09:00
example_text_marshaling_test.go Add examples 2020-08-27 21:02:44 +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 Fix encoding of json.Number 2020-08-21 01:12:29 +09:00
json_test.go Refactor 2020-08-25 11:18:01 +09:00
number_test.go Add test cases 2020-08-25 00:56:23 +09:00
rtype.go Fix MarshalJSON/MarshalText 2020-08-18 13:36:36 +09:00
struct_field.go Fix processing of anonymous field 2020-08-22 18:15:39 +09:00
tagkey_test.go Fix map key type 2020-08-25 11:17:38 +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