Fast JSON encoder/decoder compatible with encoding/json for Go
Go to file
Masaaki Goshima 1aad6b6bfa
Merge pull request #9 from goccy/feature/fix-null-values
Fix handling of null value for some types
2020-08-08 13:23:32 +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
LICENSE Initial commit 2020-04-19 18:32:37 +09:00
README.md Update README.md 2020-08-02 17:38:04 +09:00
decode.go Support InputOffset 2020-07-31 20:31:14 +09:00
decode_array.go Fix null value for struct field 2020-08-08 13:20:42 +09:00
decode_bool.go Optimize streaming decoder 2020-07-31 17:10:03 +09:00
decode_compile.go Add stream decoder 2020-05-24 21:31:10 +09:00
decode_context.go Add benchmark for medium struct 2020-07-31 20:24:39 +09:00
decode_float.go Fix stream decoder bug 2020-07-31 18:07:11 +09:00
decode_int.go Fix stream decoder bug 2020-07-31 18:07:11 +09:00
decode_interface.go Optimize streaming decoder 2020-07-31 17:10:03 +09:00
decode_map.go Fix null value for struct field 2020-08-08 13:20:42 +09:00
decode_ptr.go Support Decoder.Token 2020-07-30 22:41:53 +09:00
decode_slice.go Fix null value for struct field 2020-08-08 13:20:42 +09:00
decode_stream.go Improve performance for stream decoding 2020-07-31 22:38:43 +09:00
decode_string.go Fix null in string type 2020-08-08 12:21:25 +09:00
decode_struct.go Optimize streaming decoder 2020-07-31 17:10:03 +09:00
decode_test.go Fix null value for struct field 2020-08-08 13:20:42 +09:00
decode_uint.go Fix stream decoder bug 2020-07-31 18:07:11 +09:00
decode_unmarshal_json.go Support Decoder.Token 2020-07-30 22:41:53 +09:00
decode_unmarshal_text.go Support Decoder.Token 2020-07-30 22:41:53 +09:00
encode.go Add noescape trick for decoding 2020-05-09 00:00:08 +09:00
encode_compile.go Add error type compatible with encoding/json 2020-05-09 01:07:33 +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 Support MarshalJSON/MarshalText 2020-05-04 18:39:17 +09:00
encode_string.go Support SetEscapeHTML 2020-05-03 17:41:33 +09:00
encode_test.go Support MarshalerError 2020-05-09 01:38:00 +09:00
encode_vm.go Support MarshalerError 2020-05-09 01:38:00 +09:00
error.go Support SyntaxError 2020-05-23 12:51:09 +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
json.go Add stream decoder 2020-05-24 21:31:10 +09:00
rtype.go Add error type compatible with encoding/json 2020-05-09 01:07:33 +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

  • Compact
  • HTMLEscape
  • Indent
  • Marshal
  • MarshalIndent
  • Unmarshal
  • Valid
  • NewDecoder
  • (*Decoder).Buffered
  • (*Decoder).Decode
  • (*Decoder).DisallowUnknownFields
  • (*Decoder).InputOffset
  • (*Decoder).More
  • (*Decoder).Token
  • (*Decoder).UseNumber
  • Delim
  • (Delim).String
  • NewEncoder
  • (*Encoder).Encode
  • (*Encoder).SetEscapeHTML
  • (*Encoder).SetIndent

Error

  • InvalidUTF8Error
  • InvalidUnmarshalError
  • MarshalerError
  • SyntaxError
  • UnmarshalFieldError
  • UnmarshalTypeError
  • UnsupportedTypeError
  • UnsupportedValueError

License

MIT