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

102718073-82ac9280-4329-11eb-94f2-c5377a2feeed

102718071-804a3880-4329-11eb-9e70-5de74e55a553

Decode

So faster than json-iterator/go

json.Unmarshal

SmallStruct

89118870-5b713800-d4e4-11ea-9c80-47008d998e70

MediumStruct

89118884-86f42280-d4e4-11ea-965c-b72764870ed0

LargeStruct

89118902-9c694c80-d4e4-11ea-94e6-8c888cdb6361

Stream Decode

SmallStruct

89118906-b0ad4980-d4e4-11ea-80fb-2a6e9e7a066e

MediumStruct

89118917-c02c9280-d4e4-11ea-8ba8-776cdbf970df

LargeStruct

89118920-c28eec80-d4e4-11ea-91cc-424cfe726539

GitHub