Convert JSON and XML to TSON serialization format and reduce LLM tokens by 30–60%. Lower your GPT, Claude, and Gemini API costs instantly.
Same data, three formats. See how TSON eliminates every byte of redundant syntax while preserving complete data fidelity.
| Feature | JSON | XML | TSON ✦ |
|---|---|---|---|
| Token Efficiency | High redundancy | Very high redundancy | 30–60% reduction |
| Repeated Keys | Every object | Every tag pair | Written once |
| Closing Syntax | } ] needed | </tag> required | None |
| Comments | Not supported | Verbose only | # inline |
| Type Inference | Partial | None (all strings) | Full + optional hints |
| Human Readability | Good | Poor | Excellent |
| LLM Parsing | Universal | Universal | Native-optimized |
TSON (Token Serialized Object Notation) is an open, lightweight data serialization format invented in 2026 — purpose-built for communication with Large Language Models such as GPT, Claude, and Gemini.
Existing formats like JSON and XML were designed for machine-to-machine data exchange, not for AI inference. They carry significant syntactic overhead: brackets, closing tags, repeated keys, and mandatory quotation marks that consume tokens without adding meaning to a language model.
TSON eliminates that overhead. It uses indentation for hierarchy, infers types natively, and collapses uniform arrays into columnar notation — reducing token usage by 30–60% while improving readability for both humans and AI.
TSON is completely lossless. Every TSON document converts perfectly back to JSON or XML. It is the optimal format for the AI prompt layer — not a replacement for JSON in APIs or databases.
The complete formal specification for the TSON format. Canonical reference authored by Muhammad Yasir, 2026.
TSON documents are plain UTF-8 text files with the .tson extension. Key-value pairs are separated by : (colon + space). Hierarchy is defined by 2-space indentation. No closing brackets, braces, or tags are used.
TSON infers types automatically. No type declarations are needed in most cases.
| Type | Example | Notes |
|---|---|---|
| String | Hello World | No quotes unless value contains reserved chars |
| Quoted String | "Smith, John" | Required when value contains : , | # ~ |
| Integer | 42 | No decimal point |
| Float | 3.14 | Contains decimal point |
| Boolean | true / false | Lowercase only |
| Null | ~ | Tilde represents null / nil / None |
| Date | 2026-03-06 | ISO 8601, auto-detected |
| Array | [a, b, c] | Inline bracket notation for simple arrays |
Nested objects use 2-space indentation. Dot notation is available as shorthand for single-value deep paths.
Simple arrays use inline bracket notation. Arrays of objects use row notation with the -> row marker — one object per line, keys and values inline.
When an array contains objects with identical keys, TSON uses columnar notation. Keys written once, values comma-separated. This is the primary token-savings mechanism. Declare length as key[N]: or [?] when unknown.
Multiline values use the pipe operator |. Content block is indented below the key. Trailing whitespace is trimmed per line.
When type inference is ambiguous, append an inline type hint <type> after the value.
| Hint | Example | Use Case |
|---|---|---|
| <int> | id: 007 <int> | Force integer (prevent string inference) |
| <float> | rate: 5 <float> | Force float on whole number |
| <str> | code: 01 <str> | Force string on numeric-looking value |
| <date> | dt: 20260306 <date> | Parse non-ISO date strings |
| <b64> | data: SGVsbG8= <b64> | Mark base64-encoded value |
| <url> | path: /api/v1 <url> | Mark as URL path |
Define anchors with @name:, reference them with &name. Eliminates repeated structures and saves tokens on recurring data.
Begin with #, continue to end of line. Inline comments allowed after a value with one space before #. Comments are stripped during parsing and do not affect data.
| Expression | Meaning | JSON Equivalent |
|---|---|---|
| key: ~ | Explicit null | "key": null |
| key: | Empty string | "key": "" |
| (omitted) | Key absent from object | key not present |
| key: [] | Empty array | "key": [] |
| Rule | Correct | Incorrect |
|---|---|---|
| Key separator | key: value | key:value · key=value |
| Indentation | 2 spaces | tabs · 4 spaces |
| Boolean | true / false | True · TRUE · yes · 1 |
| Null | ~ | null · NULL · nil · none |
| Comments | # text | // text · /* text */ |
| File extension | .tson | .txt · .tson.txt |
| Encoding | UTF-8 only | UTF-16 · ASCII |
TSON is available across major programming languages. All libraries follow the TSON Spec v1.0 and are open source under MIT license.
Copy your JSON or XML and paste it into the input area. Click "Load Example" to see a live conversion.
Select delimiter (comma, pipe, tab) and indentation. Options update TSON output in real time.
The savings bar shows before, after, percentage saved, and estimated API cost reduction instantly.
Copy to clipboard or download as a .tson file. All processing is local — your data never leaves your browser.
Reduce API costs and optimize LLM token usage. The most efficient serialization format for GPT, Claude, and Gemini.
Eliminates brackets, closing tags, repeated keys, and unnecessary quotes — the four biggest token drains in JSON and XML.
Lower your GPT, Claude, and Gemini API costs by 30–60% on average. Immediate savings on every API call.
All conversion happens locally in your browser. Zero servers, zero logging, zero tracking. Guaranteed privacy.
Convert to TSON for LLM prompts, back to JSON or XML when needed. Zero information loss in either direction.
Indentation-based structure mirrors Python and Markdown — formats LLMs already parse natively and accurately.
Fully open spec, MIT-licensed libraries. Any developer can implement a TSON parser in any language.
Convert your JSON and XML to TSON now — completely free, no account required.