scon
SCON — Schema-Compact Object Notation
A human-readable data serialization format with structural deduplication. 59-66% payload reduction, 64% fewer LLM tokens, no binary encoding.
Quick Start
use ;
let mut data = new;
data.insert;
data.insert;
let obj = Object;
let scon_str = encode;
let parsed = decode.unwrap;
assert_eq!;
Features
- 3 decoder modes: Owned (two-pass), Borrowed (zero-copy arena), Tape (single-pass flat)
- Structural dedup: xxHash128 fingerprinting detects repeated subtrees, replaces with schema references — 59-66% payload reduction on OpenAPI specs
- Schema subsystem: Registry with cycle detection, deep merge, dot-notation overrides
- Validation: Loose/Warn/Strict modes with OpenAPI enforcement rules
- Minifier: Bidirectional minify (indent to semicolons) and expand
Performance
Single-pass tape decoder, 500 iterations, release mode, tracking allocator:
| Dataset | Decode | Peak memory | Payload reduction |
|---|---|---|---|
| OpenAPI (71 endpoints) | 0.195 ms | 3,874 KB | -66% (dedup) |
| DB (24 DDL schemas) | 0.045 ms | 3,512 KB | -29% |
| Config (40 records) | 0.292 ms | 4,111 KB | -8% |
| ISA-95 (equipment hierarchy) | 0.011 ms | 4,568 KB | -87% (dedup) |
LLM token efficiency (cl100k_base): 64% fewer tokens on OpenAPI specs — less context window waste for RAG pipelines and tool-use agents.
Full methodology: DOI 10.5281/zenodo.14733092 Benchmarks, optimization log (21 phases), and industrial protocol fixtures: github.com/QuijoteShin/scon
Format
name: scon
version: 1
features:
dedup: true
modes[3]: owned, borrowed, tape
endpoints[2]{method,path,status}:
GET, /api/users, 200
POST, /api/users, 201
No braces, no brackets, no repeated keys in uniform arrays, unquoted strings, built-in schema dedup via @s:name references.
API
use *;
// Encode / Decode
let encoded = encode;
let decoded = decode?;
// Structural dedup (auto-extracts repeated subtrees)
let deduped = encode_with_dedup;
// Minify / Expand
let mini = minify;
let expanded = expand;
// Tape decoder (single-pass, fastest)
let tape = new.decode?;
// Borrowed decoder (zero-copy, bumpalo arena)
let arena = new;
let borrowed = new.decode?;
// Validation
let result = new
.validate;
License
MIT