scon
SCON — Schema-Compact Object Notation
A human-readable data serialization format with structural deduplication. Smaller than JSON, faster to parse, 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
The tape decoder beats simd-json on 2/3 benchmark datasets:
| Dataset | vs simd-json | vs serde_json |
|---|---|---|
| OpenAPI | 21% faster | 53% faster |
| DB | 18% faster | 35% faster |
| Config | 8% slower | 40% faster |
500 iterations, release mode, tracking allocator. Full methodology: DOI 10.5281/zenodo.14733092
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