You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Schema header in {} — field names, optional :type hints
Data in () — positional values matching schema order
Arrays in []
Nested structs in ()
Strings auto-quoted when containing special chars
/* block comments */ supported
Binary Format
Type
Encoding
bool
1 byte (0/1)
i8/u8
1 byte
i16/u16
2 bytes LE
i32/u32
4 bytes LE
i64/u64
8 bytes LE
f32
4 bytes LE (IEEE 754 bitcast)
f64
8 bytes LE (IEEE 754 bitcast)
[]const u8
u32 LE length + UTF-8 bytes
?T
u8 tag (0=null, 1=some) + payload
[]T
u32 LE count + T × count
struct
fields in declaration order
Performance
Benchmarks on Apple M-series (arm64), Zig 0.15.2 ReleaseFast:
Serialize Speed (ASON vs JSON)
Workload
JSON
ASON Text
ASON Binary
Flat struct × 100
5.15ms
2.49ms (2.1x)
0.75ms (6.8x)
Flat struct × 1000
20.99ms
11.05ms (1.9x)
2.98ms (7.1x)
Flat struct × 5000
101.64ms
53.24ms (1.9x)
16.52ms (6.2x)
Deep 5-level × 100
63.76ms
40.41ms (1.6x)
8.90ms (7.2x)
Deserialize Speed
Workload
JSON
ASON Text
ASON Binary
Flat struct × 100
5.70ms
2.53ms (2.3x)
0.32ms (17.7x)
Flat struct × 1000
25.38ms
16.86ms (1.5x)
1.08ms (23.5x)
Flat struct × 5000
131.29ms
65.78ms (2.0x)
5.34ms (24.6x)
Deep 5-level × 100
81.00ms
45.07ms (1.8x)
3.93ms (20.6x)
Single Struct Roundtrip (encode + decode)
Struct
JSON
ASON Text
ASON Binary
Flat (8 fields)
441ns
233ns (1.9x)
32ns (14.0x)
Deep (5-level nested)
1601ns
1267ns (1.3x)
152ns (10.5x)
Size Savings
Workload
JSON
ASON Text
ASON Binary
Flat × 1000
121,675 B
56,716 B (53% smaller)
74,454 B (39% smaller)
Deep × 100
438,011 B
195,711 B (55% smaller)
225,434 B (49% smaller)
10k records
1,226,725 B
576,766 B (53% smaller)
744,504 B (39% smaller)
Throughput (1000 records × 100 iterations)
Operation
JSON
ASON
Serialize
5.1M records/s (592 MB/s)
9.5M records/s (515 MB/s) — 1.86x
Deserialize
4.1M records/s
9.7M records/s — 2.35x
Supported Types
Zig Type
ASON Text
ASON Binary
bool
true / false
1 byte
i8..i64
decimal integer
LE fixed-width
u8..u64
decimal integer
LE fixed-width
f32, f64
decimal float
IEEE 754 bitcast
[]const u8
plain or "quoted" string
u32 len + bytes
?T
value or empty
u8 tag + payload
[]const T
[v1,v2,...]
u32 count + elements
struct
(f1,f2,...)
fields in order
Build & Run
# Build all examples
zig build
# Run examples
./zig-out/bin/basic
./zig-out/bin/complex
./zig-out/bin/bench
# Run with optimizations (for benchmarking)
zig build -Doptimize=ReleaseFast
./zig-out/bin/bench
# Run tests
zig build test