Structure data with ASCII control codes.
One vocabulary, multiple shapes.
Between text formats and binary formats — values are UTF-8, structure is single bytes
{
"users": [
{"name": "Alice", "amount": "1502.30"},
{"name": "Bob", "amount": "340.00"}
],
"products": [
{"id": "01", "product": "Widget"},
{"id": "02", "product": "Gadget"}
]
}
␜mydb ␝users ␁␞name␟amount ␞Alice␟1502.30 ␞Bob␟340.00 ␝products ␁␞id␟product ␞01␟Widget ␞02␟Gadget ␄
Each glyph is a single-byte control code. No braces, no quotes; a value that needs them is fenced by two bytes, ␂…␃.
Four hierarchical data separators — the same ones the ASCII committee designed in 1963.
ASCII has 32 control codes (0x00–0x1F) designed for structuring data. C0DATA assigns meaning to 16 of them.
| Glyph | Byte | Abbr | Role |
|---|---|---|---|
| ␜ | 0x1C | FS | File separator |
| ␝ | 0x1D | GS | Group / table / section separator; repeated for depth |
| ␞ | 0x1E | RS | Record / row separator |
| ␟ | 0x1F | US | Unit / field separator |
| ␁ | 0x01 | SOH | Key (␁key␟value) or header row (␁␞) |
| ␂ | 0x02 | STX | Open text |
| ␃ | 0x03 | ETX | Close text |
| ␐ | 0x10 | DLE | Open a nested level; inside text, escape the next code |
| ␘ | 0x18 | CAN | Close a nested level |
| ␅ | 0x05 | ENQ | Reference (look up named data) |
| ␇ | 0x07 | BEL | Comment, or dead marker before an element |
| ␖ | 0x16 | SYN | Start of document; heading follows |
| ␄ | 0x04 | EOT | End of document |
| ␗ | 0x17 | ETB | Commit marker (stream logs) |
| ␙ | 0x19 | EM | End of medium; raw blob follows |
| ␚ | 0x1A | SUB | Substitution (C0-DIFF) |
The same codes express every common data shape.
// Like CSV or SQL tables ␝users ␁␞name␟amount␟type ␞Alice␟1502.30␟DEPOSIT ␞Bob␟340.00␟WITHDRAWAL
// Like TOML or INI: a keyed record is a map ␝database ␞␁host␟localhost␁port␟5432 ␝server ␞␁host␟0.0.0.0␁port␟8080
// Like Markdown sections ␜My Document ␝Chapter 1 ␞First paragraph of text. ␞A list:␟␐ ␞Item one␟Item two ␘ ␝␝Section 1.1 ␞Nested content.
// Atomic multi-file edits ␖␁shape␟diff ␜foo.txt ␝␂Hello ␃␟world␚universe␟! // Find "Hello world!", replace "world" → "universe"
Single-byte delimiters. Zero-copy parsing. The hot loop is one comparison: byte < 0x20.
c compact — canonical wire/storage form p pretty — human-readable with Unicode glyphs
c Zero-copy — no parsing or allocation.
Fields are byte slices into the original buffer.
Benchmarks on Intel Core Ultra 7 155H, 16 GB RAM, Crystal 1.19.1 compiled with --release. Tokenizer benchmark on 10 MB synthetic document. Conversion benchmarks on 10,000-row table (506 KB C0DATA). Measured on the 0.x format; the 1.0 hot loop is unchanged and the numbers will be re-run when the ports land.
Seven implementations, one spec, one shared conformance suite. The Crystal reference is shown below; every port has the same builder and zero-copy reader.
Crystal reference c0data/c0-cr API docs TypeScript c0data/c0-js API docs Rust zero-dep c0data/c0-rs docs.rs Go pure Go c0data/c0-go pkg.go.dev C single header c0data/c0-c API docs Python C extension c0data/c0-py API docs Ruby C extension c0data/c0-rb API docs Editors VS Code c0data/c0-ed CLI c0fmt c0data/c0-fmt
# the package is c0data everywhere; in code it is c0 npm install c0data cargo add c0data # use c0::… gem install c0data # require "c0" pip install c0data-py # import c0 go get github.com/c0data/c0-go # shard.yml dependencies: c0: github: c0data/c0-cr
buf = C0::Builder.build do |b| b.syn(version: "1") b.group("users", ["name", "amount"]) b.record("Alice", "1502.30") b.record("Bob", "340.00") b.eot end
doc = C0::Document.new(buf) doc["users"].record(0).value(0) # => "Alice" (zero-copy slice)
# Command line
c0fmt import data.csv | c0fmt export json
c0fmt import config.json | c0fmt pretty
c0fmt import yaml settings.yml | c0fmt compact -o data.c0
# c0fmt lives in its own repo: c0data/c0-fmt git clone https://github.com/c0data/c0-fmt && cd c0-fmt shards build --release # → bin/c0fmt