High performance JSON decoder in Go
-
100% compatible with the Go standard library.
-
Efficient. uses less memory and roughly 5 times faster than the standard library when decoding JSON.
-
Decent streaming (io.Reader) support.
- Why another JSON decoder?
I was amazed at the number of JSON packages, but I guess i was more surprised when I realized the problems they had. I'll mention that in the next section. In short... they were incompatible, and slow. That's when I decided to create this.
- CPU dependent
Use of assembly; drops support for things like M1/raspberry pi, since they have different architectures
- Not user friendly
Complicated and (or) Incompatible APIs - making the migration difficult.
- Preparation
A switch-case needs to be written by the user, or a static code generation needs to be used.
- Not actively maintained
Newer versions are often unsupported. they sometimes have EOL packages as dependencies
- Not so fast at the end
Lots of reflections, poor streaming (io.Reader) features
go get github.com/sugawarayuuta/sonnet
The usage is the same as the standard library.
Use pkg.go.dev website, or read the blog post
Medium Payload |
---|
Small Payload | Large Payload |
---|---|
-
The reader in this package is inspired by pkg/json
-
Article written by goccy, the author of goccy/go-json (in Japanese). useful and above all interesting.