Package Exports
- zzon
- zzon/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zzon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Zig ZON › zzon
A fast, spec-compliant ZON parser and serializer for JavaScript.
ZON 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.
Installation
npm install zzon
Usage
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
import { ZON } from 'zzon';
const json = ZON.parse(`.{.a=1,.b="abc",.c=true}`);
console.log(json); // {"a":1,"b":"abc","c":true}
Playground
Benchmarks
Performance comparison between ZON and JSON (source: test/index.test.ts):
Operation | JSON | ZON | Difference |
---|---|---|---|
Parse | 254.23ms | 2544.44ms | 2290.21ms (10.01x slower) |
Stringify | 228.45ms | 1033.41ms | 804.95ms (4.52x slower) |
Hardware: Apple M1 Pro
Platform: darwin 24.4.0 (arm64)
Last updated: 2025-04-21T04:58:48.677Z