HSV vs JSON, CSV, XML, and others
| Format | Hierarchy | Escaping | Binary | Human Readable | Streaming | Parsing |
|---|---|---|---|---|---|---|
| HSV | Unlimited | Never* | Native (DLE) | Data only | Native | Parallel |
| JSON | Unlimited | Required | Base64 | Yes | Awkward | Sequential |
| CSV | 1 level | Quoting | Base64 | Yes | Line-based | Sequential |
| XML | Unlimited | Entities | Base64/CDATA | Verbose | SAX parsers | Sequential |
| MessagePack | Unlimited | Never | Native | Binary | Native | Sequential |
| Protocol Buffers | Schema | Never | Native | Binary | Native | Sequential |
* Text mode never needs escaping. Binary mode uses DLE transparency (~0.4% overhead).
{"name": "Alice", "age": 30, "city": "NYC"}
42 bytes
[STX] name [US] Alice [RS] age [US] 30 [RS] city [US] NYC [ETX]
26 bytes (38% smaller)
{"msg": "He said \"hello\""}
[STX] msg [US] He said "hello" [ETX]
{"path": "C:\\Users\\data"}
[STX] path [US] C:\Users\data [ETX]
{"text": "line 1\nline 2\nline 3"}
[STX] text [US] line 1
line 2
line 3 [ETX]
{"name": "Alice"}
{"name": "Bob"}
{"name": "Carol"}
Breaks if data contains newlines
[STX] name [US] Alice [FS] name [US] Bob [FS] name [US] Carol [ETX]
Newlines in data are fine. [STX]=start [FS]=separator [ETX]=end
{"user": {"name": "Alice", "email": "a@b.com"}}
[STX] user [US] [SSA] name [US] Alice [RS] email [US] a@b.com [ESA] [ETX]
Legend: [US] = key:value · [RS] = properties · [GS] = array · SSA/ESA = nested · [FS] = records · [STX]/[ETX] = start/end
Both JSON and HSV support unlimited nesting. HSV uses SSA/ESA (Start/End of Selected Area) for nesting depth.
| Aspect | CSV | HSV |
|---|---|---|
| Hierarchy | 1 level (rows and columns) | Unlimited (SSA/ESA nesting) |
| Delimiter | Comma (printable, common in data) | Control codes (never in data) |
| Quoting | Required for special chars | Never |
| Newlines in data | Requires quoting | Just works |
| Named fields | Header row convention | Built-in key-value |
| Nested data | Not supported | Supported |
Alice,"likes cats, dogs"
Bob,"said ""hi"""
[STX] Alice [RS] likes cats, dogs [FS] Bob [RS] said "hi" [ETX]
CSV requires quoting when data contains commas or quotes. HSV never needs quoting.
<user>
<name>Alice</name>
<age>30</age>
</user>
56 bytes
[STX] name [US] Alice [RS] age [US] 30 [ETX]
17 bytes (70% smaller)
<msg>x < y & a > b</msg>
[STX] msg [US] x < y & a > b [ETX]
HSV can represent document trees. Angle brackets are just visible nesting delimiters—SSA/ESA are invisible ones:
<div class="box">
<p>Hello <b>world</b></p>
</div>
[STX] tag [US] div [RS] class [US] box [RS] children [US] [SSA]
tag [US] p [RS] children [US] [SSA]
text [US] Hello
[GS] tag [US] b [RS] text [US] world
[ESA]
[ESA] [ETX]
Abstract syntax trees are nested structures with node types and properties—a natural fit for HSV:
{"type": "BinaryExpr",
"op": "+",
"left": {"type": "Num", "value": 1},
"right": {"type": "Num", "value": 2}}
[STX] type [US] BinaryExpr [RS] op [US] + [RS] left [US] [SSA] type [US] Num [RS] value [US] 1 [ESA] [RS] right [US] [SSA] type [US] Num [RS] value [US] 2 [ESA] [ETX]
Compiler toolchains, linters, and code formatters can exchange ASTs without escaping operators like \, ", or &&.
Templates mix literal text with structure. HSV keeps them separate without escape sequences:
Hello {{name}},
Your balance is ${{amount}}.
Click <a href="{{url}}">here</a>.
Escaping needed for quotes, angles, curlies
[STX] text [US] Hello [GS] var [US] name [GS] text [US] ,
Your balance is $ [GS] var [US] amount [GS] text [US] .
Click [GS] tag [US] a [RS] href [US] [SSA] var [US] url [ESA] [RS] text [US] here [GS] text [US] . [ETX]
Structure is separate from content
Template compilation becomes tree manipulation, not string surgery.
| Aspect | MessagePack / Protobuf | HSV |
|---|---|---|
| Size | Smallest | Slightly larger |
| Human readable | No (binary) | Yes (data visible) |
| Debuggable | Needs tools | Any text viewer |
| Escaping | Never | Never |
| Schema | Optional/required | Not needed |
| Text tools | grep, sed, awk fail | Work fine |
| Embed binary blobs | Native | DLE transparency |
HSV fills the gap: More efficient than JSON/XML, more debuggable than binary, and can still embed raw bytes when needed.
HSV uses DLE (Data Link Escape) for binary transparency—the same technique BISYNC used in 1967:
{"image": "iVBORw0KGgo..."}
Base64: 33% size overhead
[STX] image [US] [DLE] [STX] <raw PNG bytes> [DLE] [ETX] [ETX]
DLE: ~0.4% overhead (escape only 0x10)
How it works:
[DLE] [STX] (DLE STX) = start binary section[DLE] [ETX] (DLE ETX) = end binary section[DLE] [DLE] (DLE DLE) = literal DLE byteInside binary mode, only DLE needs escaping. All 21 other reserved control codes become literal data.
| Method | Delimiter | Newlines in data | Framing |
|---|---|---|---|
| NDJSON | Newline | Must escape | Implicit |
| JSON with length prefix | Byte count | OK | Binary header |
| Server-Sent Events | data: prefix |
Must escape | Text protocol |
| HSV | [STX]/[ETX] + [FS] | OK | Native |
HSV is the only format here that supports parallel parsing at every data level.
Why other formats require sequential parsing:
| Format | Why Sequential |
|---|---|
| JSON | Escape state (\") spans tokens—can't split safely |
| CSV | Quote state spans cells—newline might be inside quotes |
| XML | Entity state (&) and CDATA sections span boundaries |
| MessagePack | Length-prefixed—must decode header to find next item |
| Protobuf | Varint lengths—must decode sequentially to find boundaries |
HSV has no escape state. Every separator byte (FS, GS, RS, US, SSA, ESA) is always structural. Split on any of them, parse chunks independently.
File level: Scan for STX/ETX → split into blocks → parse blocks in parallel Record level: Scan for FS ([FS]) → split into records → parse records in parallel Property level: Scan for RS ([RS]) → split into pairs → parse pairs in parallel Array level: Scan for GS ([GS]) → split into items → parse items in parallel
Every split is just "find byte, cut." No state machine. No lookahead. No backtracking.
| Use Case | Recommended | Why |
|---|---|---|
| Config files | JSON, TOML, YAML | Human editing matters |
| API responses (simple) | HSV or JSON | HSV smaller, JSON more tooling |
| Streaming data | HSV | Native framing, no escaping |
| Log files | HSV | Multiline content, greppable |
| Data export | HSV or CSV | HSV for nested/complex data |
| High-performance | Protobuf, FlatBuffers | Binary is fastest |
| Deep nesting (10+ levels) | HSV, JSON, or XML | All support unlimited nesting |
HSV is ideal when: