TOON to JSON Converter
Convert TOON back to standard JSON for storage or tooling that expects JSON.
Recovering JSON from TOON means putting back the two things the format removed: most quotes and the field boundaries. Quoted values keep their string type, bare values have their type inferred, and the header's row and column counts are checked against the data.
How types are recovered
A value written in quotes is always a string, whatever it contains: "7" is the string 7 and "true" is the string true. A bare value is inferred. The tokens true, false and null become JSON literals, a plain decimal such as 42, -1.5 or 1e3 becomes a number, and everything else stays a string.
The rule is deliberately narrow, so you can name its edge cases before you hit them. A bare 02134 stays the string 02134, because numbers with a leading zero are not converted. Hexadecimal such as 0x1A, and the words Infinity and NaN, also stay strings. Numbers beyond 2^53 − 1 lose precision, exactly as they do in JSON.parse: a twenty-digit identifier written bare becomes 12345678901234567000. Hand-written TOON should quote any value whose text matters.
TOON produced by our JSON to TOON converter already quotes strings that would be misread, so converting it back restores the original types.
Header counts are checked
A header such as [3]{id|name|role|active}| declares how many rows follow and what the fields are called, and the converter holds the data to it. A header announcing five rows above two rows of data fails with an error such as Expected 5 rows but found 2. A row with a different number of values than the header has fields fails with the line number and the counts, and extra rows beyond the declared count are rejected too.
That matters most for TOON that came out of a language model, where a table cut off at the output limit is the typical damage: the header is the evidence, and a mismatch now stops the conversion instead of producing a shorter array.
The check cannot tell whether the values themselves are right. A row whose values were reordered against the header, or a hallucinated value, still counts correctly. Validate model output against a schema after converting, as you would any other model output.
The delimiter comes from the header
The header declares the delimiter in its last character: | means pipe-separated rows, while , or : means comma-separated rows. Every row of that table is split with that one delimiter, so there is no per-line guessing and a stray pipe in a comma table is just text.
A value that contains the delimiter is written in quotes and read back intact: 1,"a,b" under a two-column comma header is the two values 1 and a,b. An unquoted delimiter inside a value is a real extra field, and the converter reports the row as having too many values.
Keys and nesting
Plain keys (letters, digits, underscores, dots and hyphens, starting with a letter or underscore) are written bare. Any other key, such as one with a space or a delimiter in it, must be quoted: "full name"|Alice. Array headers accept both forms, so line-items[1]{a|b}| and "line items"[1]{a|b}| are both read as tables.
Nested objects are read from indentation to any depth: a profile| line followed by an indented block becomes an object, and a keyed table can sit at any level. Arrays that are not tables, and empty arrays and objects, are written as inline JSON (tags|["a","b"]) and read back as JSON. A line that cannot be read, for example a table header with no key inside an object, produces an error with its line number.
Check the shape, because valid JSON can still be wrong
Even with the checks above, a successful conversion only proves the TOON was well-formed. A schema-less validator, a linter and JSON.parse will accept a document that carries a wrong value, a mislabeled column, or a number that should have been a string.
Spot-check one value from each type-sensitive column: identifiers, postcodes, version strings, phone numbers, anything zero-padded. If the original JSON still exists, diff against it. If it does not, expanding the result in the JSON editor is a fast way to read the structure before it travels further.
How careful to be depends on where the TOON came from. TOON your own encoder produced and you are converting straight back is low risk. TOON a language model generated is untrusted input: a hallucinated extra column, values reordered against the header, or a table cut off at a token limit may still convert cleanly, so validate against a real schema afterwards.
Related tools
Try these tools that work well with this one
JSON to TOON Converter
Convert JSON to TOON to save tokens
CSV to JSON Converter
Convert CSV data to JSON
JSON to CSV Converter
Convert JSON arrays of objects to CSV
JSON to YAML Converter
Convert JSON to YAML
YAML to JSON Converter
Convert YAML to JSON
CSV to XML Converter
Convert CSV text to XML
Related guides
Tutorials and guides to get more from this tool
Introducing TOON: The Token-Oriented Object Notation
TOON is a compact, token-oriented alternative to JSON for sending structured data to LLMs. Learn the syntax, how it works, and when to use it.
The Ultimate Guide to Data Serialization: JSON, YAML, XML, and TOON
From legacy XML to modern JSON and TOON, explore the evolution of data serialization formats and when to use them.
JSON to Query String: Simplifying API Requests
Learn how to convert nested JSON objects into URL-encoded query strings significantly simplifying your API development workflow.
ThenCatch is a developer toolkit that runs in your browser. Learn more about ThenCatch.