Format guide
A JDogo document is a JSON value written so the structure of a table appears once, in a header, and rows hold only values. This page covers everything a reader needs. The normative texts are spec/SPEC_2.0.md and the 2.1 addendum the JDogo specification.
Three guarantees
- Lossless. Decoding returns the same JSON value: same keys in the same order, same strings, same numbers. A whole float may be written
5or5.0; both are the same JSON number. NaN and Infinity, which JSON has no form for, are writtennull, asJSON.stringifydoes. - JSON is valid JDogo. Any JSON text decodes to the same value, compact or indented, so every JSON producer is already a JDogo producer.
- Line oriented. One header line, one line per row.
\nor\r\n.
Document kinds
The first characters decide what follows.
| Starts with | Kind | Holds |
|---|---|---|
@name,… | Table | A list of objects, one row per line |
@= | Single object | One object, its values on the next line |
@{} | Keyed map | An object of objects; each row starts with its key |
@[] | Matrix | A list of lists of scalars |
@: | Record lines | Sparse objects, written by the AI prompt builders |
| anything else | Inline value | One value written inline |
@id,name,city -> [{"id":1,"name":"Ana","city":"Paris"},
1,Ana,Paris {"id":2,"name":"Bo","city":"Oslo"}]
2,Bo,Oslo
@=name,tags -> {"name":"Ana","tags":["a","b"]}
Ana,[a,b]
@{}age,city -> {"u1":{"age":31,"city":"Paris"},"u2":{"age":28,"city":"Oslo"}}
u1,31,Paris
u2,28,Oslo
@[] -> [[1,2],[3,4]]
1,2
3,4Header forms
Each header field is a name, optionally followed by one form that says how its cells are written. Writers pick a form only when it fits every row exactly.
| Form | Example | Meaning |
|---|---|---|
| none | city | Any value, written inline |
+ | id+ | Whole numbers stored as the step from the row above |
^prefix | sku^SKU- | Strings sharing a prefix; the cell holds the rest |
$suffix | email$@acme.io | Strings sharing a suffix; the cell holds the start |
^prefix+ | id^ORD-+ | Prefix, then a whole number stored as a step |
=value | status=open | Same value in every row, no cell |
@a;b;… | city@Paris;Oslo | A dictionary; the cell holds the entry's index |
{…} | user{id,name} | A nested object whose fields are cells of this row |
?{…} | user?{id,name} | A nested object that may be missing or null |
[]{…} | items[]{sku,qty} | A list of objects: [a,1;b,2] |
A real example, six orders:
@id+,sku^SKU-+,status=open,city,qty,note 5001,8100,Cairo,3,~ 1,7,Lima,12,fragile 1,7,Oslo,5,"" 1,7,Cairo,5,fragile 1,7,Lima,40,"rush, cold chain" 1,7,Cairo,7,~
Watch it build
The same six orders, one idea at a time. Every step is a valid JDogo document that decodes to the same orders.
Cells
| Cell | Means |
|---|---|
| empty | The field is absent from this row's object |
~ | null |
^ | Same value as this column in the row above |
true false | Booleans |
42 -0.5 1e21 | Numbers |
"…" | A string, as a JSON string literal |
[…] | An inline list |
{k:v,…} | An inline object |
| other text | A string, read up to , ] } ; or the line end |
Every cell after the first keeps its comma, even when empty, so a row cut short is an error rather than silent data loss.
When strings are quoted
A string is written in quotes when it:
- is empty, or contains a control character or one of
, [ ] { } " \ ; - starts or ends with a space or tab
- is exactly
~,^,true,falseornull - looks like a number, so
"007"stays a string - starts the document with
@
Quoted strings use JSON escapes only. Decoders reject anything else.
Whitespace
As in JSON, whitespace between values means nothing: spaces around , : [ ] { }, around table cells and header names, and line breaks inside brackets are ignored. So {"a": [1, 2]}, indented JSON and a hand-written @id, name header all read as expected. Whitespace inside unquoted text, and anything in quotes, is kept; that is why strings with leading or trailing spaces are always quoted.
Rules readers enforce
- Every row has exactly the header's cells.
- Dictionary indexes must exist.
- Bytes must be valid UTF-8; invalid sequences are an error, never replaced. Numbers too large for a 64-bit float, such as
1e999, are an error. - Malformed input fails with the language's normal parse error:
IllegalArgumentException,ValueErrororError. Never a crash, never an invented value. - A leading byte-order mark (U+FEFF) is ignored, and text that is only whitespace reads as null.
- Text written by JDogo 1.x still loads, but only when it carries a 1.x marker (a
@header with|-separated rows). Anything else that is not a valid document is an error; it is never read as 1.x to get some value out of it. - Default limits: nesting depth 64, 100,000 items per collection. See Security and limits.
How it's kept honest
The normative rules are in the JDogo specification, and each one cites the shared test that checks it. 203 reference encodings from the Java codec must decode identically in every SDK. A cross-language fuzzer encodes random values in each SDK and decodes them in all three. Another fuzzer feeds every decoder broken and hostile text.