Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orsinium-labs/jsony
⚡️ A blazing fast and safe Go package for serializing JSON
https://github.com/orsinium-labs/jsony
encoder encoding go golang json json-serialization serialization serializer
Last synced: 6 days ago
JSON representation
⚡️ A blazing fast and safe Go package for serializing JSON
- Host: GitHub
- URL: https://github.com/orsinium-labs/jsony
- Owner: orsinium-labs
- License: mit
- Created: 2024-11-01T07:45:07.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-13T19:03:29.000Z (3 months ago)
- Last Synced: 2025-01-19T22:10:47.509Z (13 days ago)
- Topics: encoder, encoding, go, golang, json, json-serialization, serialization, serializer
- Language: Go
- Homepage:
- Size: 38.1 KB
- Stars: 173
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsony
[ [📄 docs](https://pkg.go.dev/github.com/orsinium-labs/jsony) ]
[ [🐙 github](https://github.com/orsinium-labs/jsony) ]A blazing fast and safe Go package for serializing JSON.
Features:
* 2-3 times faster than stdlib
* type safe and with no runtime errors or panics
* pure go
* reflection-free
* objects preserve elements' order
* objects can be constructed dynamically## 📦 Installation
```bash
go get github.com/orsinium-labs/jsony
```## 🔧 Usage
```go
obj := jsony.Object{
jsony.Field{"name", jsony.String("Aragorn")},
jsony.Field{"age", jsony.Int(87)},
}
s := jsony.EncodeString(obj)
fmt.Println(s)
```See [documentation](https://pkg.go.dev/github.com/orsinium-labs/jsony).
## 🐎 Benchmarks
Each value is time (in ns) per operation, as reported by the Go built-in benchmark framework. Lower is better.
| category | jsony | stdlib |
| ------------ | --------: | -------: |
| Int | 15 🏆 | 54 |
| Float64 | 63 🏆 | 122 |
| String | 22 🏆 | 88 |
| Object | 134 🏆 | 136 |
| Map | 246 🏆 | 662 |
| MixedArray | 125 🏆 | 271 |
| IntArray | 88 🏆 | 183 |
| BigArray | 64262 🏆 | 115994 |To reproduce, run `task bench`