#inspector #binary-json #cli #binary #zon

app zon-inspector

CLI tool to inspect and convert ZON files to JSON

1 unstable release

0.1.0 Feb 6, 2026

#1328 in Command line utilities

MIT license

22KB
276 lines

๐ŸŽฏ ZON

Stop Parsing. Start Reading.

A Zero-Copy, Schema-Less Binary Format
6.2ร— Faster than JSON

Crates.io NPM Documentation License

Quick Start โ€ข Why ZON? โ€ข Benchmarks โ€ข Documentation


โšก ZON in 30 Seconds

ZON removes the "JSON tax."
Your data becomes a high-speed binary format that browsers and servers can read instantlyโ€”without the CPU overhead of parsing.

import { ZonReader } from '@zon-lib/zon';

async function loadData() {
  const res = await fetch('https://api.example.com/stats.zon');
  const buffer = new Uint8Array(await res.arrayBuffer());

  // โœจ wrap the buffer โ€” no parsing happens here
  const stats = new ZonReader(buffer);

  // ๐Ÿš€ read data at o(1) speed
  console.log(stats.readU32(8)); 
}

The Result? 6.2ร— faster data access with zero parsing overhead.


๐ŸŽฏ Quick Install

# node.js / web (wasm)
npm install @zon-lib/zon

# rust (systems)
cargo add zon-lib

# cli inspector
cargo install zon-inspector

๐Ÿ’ก The Philosophy

Modern applications suffer from a "Parsing Tax." Whether JSON or Protobuf, your CPU wastes massive cycles translating text into memory before you can even use it.

ZON (Zero-Overhead Notation) eliminates this translation step.

The binary format on disk is the exact same layout your CPU requires in memory.

Core Principles:

  • ๐ŸŽฏ Zero-Copy Access โ€” We don't parse. We map directly to memory.
  • ๐Ÿ“ Schema-Less โ€” No .proto files. No code generation.
  • ๐ŸŒ Universal โ€” Native speed in Rust. Instant bridging in WASM.

๐ŸŒ Why for Web?

Lower Battery Drain โ€” Less CPU usage means better battery life for mobile users
Zero UI Lag โ€” Large datasets (maps, 3D models, telemetry) load without freezing
Edge Ready โ€” Minimal memory footprint for Vercel Functions and Cloudflare Workers


๐Ÿ“Š Benchmarks

ZON vs. JSON (Accessing a composite Player struct)

Format Mean Access Time Throughput Speedup
JSON ~117.43 ns ~8.5 M ops/s 1ร—
ZON ~18.83 ns ~53.1 M ops/s ๐Ÿš€ 6.2ร—

Benchmark conducted on a strictly aligned composite workload on a consumer workstation.

What this means for you:

  • Web Apps: Load 6ร— more data in the same time budget
  • APIs: Serve 6ร— more requests with the same infrastructure
  • Mobile: Save precious battery and reduce heat

๐Ÿ› ๏ธ Usage

๐ŸŒ Web (Browser & Node.js)

Instant data access with zero parsing lag.

import { serialize, ZonReader } from '@zon-lib/zon';

// step 1: serialize to binary (server-side)
const binary = serialize({ name: "Hero", hp: 100 });

// step 2: zero-copy read (client-side)
// ๐Ÿ”ฅ no parsing occurs here โ€” we simply wrap the memory buffer
const reader = new ZonReader(binary);

// step 3: o(1) direct access
const root = reader.rootOffset;
console.log(reader.readString(root)); // "hero"

Key Benefits:

  • โœ… No JSON.parse() overhead
  • โœ… Instant data availability
  • โœ… Lower memory pressure

โš™๏ธ Systems (Rust)

The core engine for HFT, Game Engines, and System Tools.

use zon_lib::{ZonWriter, ZonReader};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 1. write with cache-line alignment
    let mut writer = ZonWriter::new();
    let name_off = writer.write_string("Hero");
    
    // 2. map bytes directly
    let buffer = writer.as_bytes();
    let reader = ZonReader::new(buffer)?;
    
    // 3. access with zero allocations
    let name = reader.read_string(name_off)?;
    println!("Name: {}", name);
    
    Ok(())
}

Performance Characteristics:

  • โœ… Zero allocations in hot path
  • โœ… CPU cache-friendly (64-byte aligned)
  • โœ… Safe concurrent access

๐Ÿ” CLI Inspector

Visualize .zon files without writing code.

# install once
cargo install zon-inspector

# inspect any .zon file
zon-inspector data.zon

Output Example:

๐Ÿ“ฆ ZON File: data.zon
โ”œโ”€ Size: 1.2 KB
โ”œโ”€ Entries: 42
โ””โ”€ Root Object
   โ”œโ”€ name: "Hero"
   โ””โ”€ hp: 100

๐Ÿ“š Documentation

Platform Link
๐Ÿš€ Web Guide โ€” Quick Start, Performance Patterns, Integration Examples zon.mintlify.app
โš™๏ธ Rust API Docs โ€” Complete API Reference, Type Specifications, Memory Layout docs.rs/zon-lib

๐ŸŒ Real-World Use Cases

Use Case Description
๐Ÿ“ˆ High-Frequency Trading Nanosecond order book updates without parsing overhead
๐ŸŽฎ Multiplayer Games Synchronize thousands of entities with zero lag
๐Ÿ“Š Telemetry Ingest Massive logging without JSON stringification cost

Also Great For:
๐Ÿ—บ๏ธ Geographic data (maps, tiles, GeoJSON) โ€ข ๐Ÿค– ML inference pipelines โ€ข ๐Ÿ“ก IoT sensor streams โ€ข ๐ŸŽฌ Video/audio metadata


๐Ÿค Contributing

Core Principles:

  • ๐ŸŽฏ Zero-Copy โ€” No memory allocations in the hot path
  • โšก 64-Byte Aligned โ€” Respect CPU cache line architecture
  • ๐Ÿ”’ Memory Safe โ€” Leverage Rust's type system

Development Setup:

# test core rust
cargo test --workspace

# build webassembly package
cd crates/zon-lib && wasm-pack build --target nodejs

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.


Built with โค๏ธ by Zaim Abbasi โ€ข Released under the MIT License

Dependencies

~275โ€“760KB
~15K SLoC