https://github.com/nurulhudaapon/zzon
A fast, spec compliant, ZON parser and serializer for JavaScript.
https://github.com/nurulhudaapon/zzon
javascript js json ts typescript zig zig-package zon
Last synced: about 2 months ago
JSON representation
A fast, spec compliant, ZON parser and serializer for JavaScript.
- Host: GitHub
- URL: https://github.com/nurulhudaapon/zzon
- Owner: nurulhudaapon
- Created: 2025-04-16T16:05:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-10-24T05:04:06.000Z (7 months ago)
- Last Synced: 2026-01-02T13:51:29.611Z (5 months ago)
- Topics: javascript, js, json, ts, typescript, zig, zig-package, zon
- Language: TypeScript
- Homepage: https://zzon.nuhu.dev/
- Size: 1.76 MB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Zig ZON › zzon
A fast, spec-compliant ZON parser and serializer for JavaScript.
[ZON](https://github.com/ziglang/zig/pull/20271) is a compact, human-readable, and easy-to-parse data format from the Zig programming language that is similar to JSON in JavaScript.
The API is similar to the native [`JSON` API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON).
[Try it in the Playground](https://zzon.nuhu.dev)
## Installation
```bash
npm install zzon
```
## Usage
#### Stringify
```ts id="stringify"
import { ZON } from 'zzon';
const zon = ZON.stringify({"a":1,"b":"abc","c":true});
console.log(zon); // .{.a=1,.b="abc",.c=true}
```
#### Parse
```ts id="parse"
import { ZON } from 'zzon';
const json = ZON.parse(`.{.a=1,.b="abc",.c=true}`);
console.log(json); // {"a":1,"b":"abc","c":true}
```
## [Playground](https://zzon.nuhu.dev)

## Benchmarks
Performance comparison between ZON and JSON (source: [test/index.test.ts](test/index.test.ts)):
| Operation | JSON | ZON | Difference |
|-----------|------|-----|------------|
| Parse | 430.80 MB/s | 38.66 MB/s | 11.04x slower |
| Stringify | 454.94 MB/s | 87.43 MB/s | 5.15x slower |
Hardware: Apple M1 Pro
Platform: darwin 25.0.0 (arm64)
*Last updated: 2025-10-24T03:55:48.380Z*
## Example Usage
- [Browser](./example/browser)
- [Bun](./example/bun)
## License
[MIT](https://github.com/nurulhudaapon/zzon/blob/main/LICENSE)