v1.0 Standard Release  ·  Open Format

JSON to TSON Converter
Cut Your LLM Token Costs

Convert JSON and XML to TSON serialization format and reduce LLM tokens by 30–60%. Lower your GPT, Claude, and Gemini API costs instantly.

Input:
Delimiter: Indent:
JSON Input 0 tokens
TSON Output 0 tokens
Output will appear here after conversion...
0
Tokens Before
0
Tokens After
0%
Tokens Saved
Token reduction
$0.0000
Est. Cost Saved*
30–60%
Token Reduction
JSON + XML
Input Formats
Zero
Data Loss
GPT · Claude · Gemini
LLM Compatible
Free
Forever
Formats Compared

TSON vs JSON vs XML

Same data, three formats. See how TSON eliminates every byte of redundant syntax while preserving complete data fidelity.

JSON — Standard ~156 tokens
{ "users": [ { "id": 1, "name": "Alice Johnson", "email": "[email protected]", "role": "admin", "active": true }, { "id": 2, "name": "Bob Smith", "email": "[email protected]", "role": "user", "active": true } ] }
XML — Standard ~198 tokens
<users> <user> <id>1</id> <name>Alice Johnson</name> <email>[email protected]</email> <role>admin</role> <active>true</active> </user> <user> <id>2</id> <name>Bob Smith</name> <email>[email protected]</email> <role>user</role> <active>true</active> </user> </users>
TSON — Optimized ✦ ~64 tokens · 59% smaller
# Keys written once. Values comma-separated. users[2]: id: 1, 2 name: Alice Johnson, Bob Smith email: [email protected], [email protected] role: admin, user active: true, true # Zero redundant syntax. # 59% fewer tokens.
FeatureJSONXMLTSON ✦
Token EfficiencyHigh redundancyVery high redundancy30–60% reduction
Repeated KeysEvery objectEvery tag pairWritten once
Closing Syntax} ] needed</tag> requiredNone
CommentsNot supportedVerbose only# inline
Type InferencePartialNone (all strings)Full + optional hints
Human ReadabilityGoodPoorExcellent
LLM ParsingUniversalUniversalNative-optimized
About TSON

What is TSON?

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.

MY
Muhammad Yasir
Inventor & Author of TSON  ·  Systems & Cybersecurity Specialist  ·  RESO RED-T  ·  Saskatoon, Canada  ·  2026
Format Lineage — Data Notation Standards
1998XML Verbose tag-based. Built for document exchange. Legacy
2001JSON Bracket notation. Built for APIs and JS interop. Redundant
2001YAML Human-readable config format. Not token-aware. Config
2013TOML Tom's Obvious Minimal Language. Config-focused. Config
2026 TSON Token Serialized Object Notation. Built for LLMs. New ✦
Specification

TSON Spec v1.0

The complete formal specification for the TSON format. Canonical reference authored by Muhammad Yasir, 2026.

§1 Basics

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
name: Muhammad Yasir role: Systems Specialist active: true score: 98.5 joined: 2026-03-06

§2 Data Types

TSON infers types automatically. No type declarations are needed in most cases.

TypeExampleNotes
StringHello WorldNo quotes unless value contains reserved chars
Quoted String"Smith, John"Required when value contains : , | # ~
Integer42No decimal point
Float3.14Contains decimal point
Booleantrue / falseLowercase only
Null~Tilde represents null / nil / None
Date2026-03-06ISO 8601, auto-detected
Array[a, b, c]Inline bracket notation for simple arrays

§3 Hierarchy & Nesting

Nested objects use 2-space indentation. Dot notation is available as shorthand for single-value deep paths.

TSON — Nesting
user: id: 1042 name: Muhammad Yasir address: city: Saskatoon province: Saskatchewan country: Canada # Dot shorthand for single paths: user.address.country: Canada

§4 Arrays

Simple arrays use inline bracket notation. Arrays of objects use row notation with the -> row marker — one object per line, keys and values inline.

TSON — Arrays
# Simple inline array skills: [Azure, Cybersecurity, RESO, PowerShell] # Array of objects — row notation servers: -> id:1 host:db01.local status:online -> id:2 host:db02.local status:offline -> id:3 host:db03.local status:online

§5 Columnar Mode

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.

TSON — Columnar (highest compression)
products[3]: id: 101, 102, 103 name: Widget A, Widget B, Widget C price: 9.99, 14.99, 4.99 stock: 100, 0, 42 active: true, false, true # Values containing commas must be quoted: # name: "Smith, John", "Jones, Bob"

§6 Multiline Strings

Multiline values use the pipe operator |. Content block is indented below the key. Trailing whitespace is trimmed per line.

TSON — Multiline
description: | TSON is a token-efficient data notation format designed natively for Large Language Models. It reduces token usage by 30–60 percent. changelog: | v1.0 — Initial release, March 2026. v1.1 — Added anchor support.

§7 Optional Type Hints

When type inference is ambiguous, append an inline type hint <type> after the value.

HintExampleUse 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

§8 Anchors & References

Define anchors with @name:, reference them with &name. Eliminates repeated structures and saves tokens on recurring data.

TSON — Anchors
# Define reusable anchors @base_perms: [read, write, list] @admin_perms: [read, write, list, delete, admin] # Reference anchors inline users[2]: name: Alice, Bob perms: &admin_perms, &base_perms

§9 Comments

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.

TSON — Comments
# Full line comment — stripped by parser version: 1.0 # inline comment format: TSON # Token Serialized Object Notation

§10 Null, Empty & Missing

ExpressionMeaningJSON Equivalent
key: ~Explicit null"key": null
key:Empty string"key": ""
(omitted)Key absent from objectkey not present
key: []Empty array"key": []

§11 Core Rules

RuleCorrectIncorrect
Key separatorkey: valuekey:value · key=value
Indentation2 spacestabs · 4 spaces
Booleantrue / falseTrue · TRUE · yes · 1
Null~null · NULL · nil · none
Comments# text// text · /* text */
File extension.tson.txt · .tson.txt
EncodingUTF-8 onlyUTF-16 · ASCII
Developer Libraries

Official TSON Implementations

TSON is available across major programming languages. All libraries follow the TSON Spec v1.0 and are open source under MIT license.

@tson/core
npm · Browser & Node.js · TypeScript included
Stable
Install
npm install @tson/core # or yarn add @tson/core # or pnpm add @tson/core
Usage — JavaScript / TypeScript
Serialize, parse, convert
v1.0.0
JavaScript
import { toTSON, fromTSON, jsonToTSON } from '@tson/core'; // Convert JSON string to TSON const tson = jsonToTSON('{"name":"Alice","age":30}'); // → name: Alice\nage: 30 // Serialize JS object to TSON const output = toTSON({ name: 'Alice', age: 30 }); // Parse TSON back to object const obj = fromTSON('name: Alice\nage: 30'); // Convert XML to TSON const tson2 = xmlToTSON(xmlString);
tson-format
PyPI · Python 3.8+ · Type hints included
Stable
Install
pip install tson-format # or poetry add tson-format # or uv add tson-format
Usage — Python
Serialize, parse, convert
v1.0.0
Python
import tson # Serialize dict to TSON string output = tson.dumps({"name": "Alice", "age": 30}) # Parse TSON string to dict data = tson.loads("name: Alice\nage: 30") # Convert JSON file to TSON tson.json_to_tson("data.json", "output.tson") # Convert XML to TSON tson.xml_to_tson("data.xml", "output.tson") # Count token savings report = tson.savings_report(json_str) # → {"before": 156, "after": 64, "saved_pct": 59}
tson
crates.io · Rust 2021 Edition · Zero unsafe
Stable
Cargo.toml
[dependencies] tson = "1.0" # or via CLI: cargo add tson
Usage — Rust
Serde-compatible serialization
v1.0.0
Rust
use tson::{to_string, from_str, json_to_tson}; use serde::{Deserialize, Serialize}; // Serialize to TSON let output = to_string(&user)?; // Deserialize from TSON let user: User = from_str("name: Alice\nage: 30")?; // Convert from JSON string let tson = json_to_tson(r#"{"name":"Alice"}"#)?; // Get token savings report let report = tson::savings(&json_str); println!("Saved {}%", report.pct_saved);
github.com/tson-format/tson-go
Go 1.21+ · Encoding interface compatible
Stable
Install
go get github.com/tson-format/tson-go
Usage — Go
Marshal/Unmarshal interface
v1.0.0
Go
import "github.com/tson-format/tson-go" // Marshal struct to TSON data, err := tson.Marshal(user) // Unmarshal TSON to struct var user User err = tson.Unmarshal([]byte("name: Alice\nage: 30"), &user) // Convert from JSON tsonStr, err := tson.FromJSON(jsonBytes) // Convert from XML tsonStr, err := tson.FromXML(xmlBytes)
com.tsonformat:tson-java
Maven Central · Java 11+ · Jackson compatible
Beta
pom.xml / build.gradle
/* Maven */ <dependency> <groupId>com.tsonformat</groupId> <artifactId>tson-java</artifactId> <version>1.0.0-beta</version> </dependency> // Gradle implementation 'com.tsonformat:tson-java:1.0.0-beta'
Usage — Java
ObjectMapper-style API
Beta
Java
import com.tsonformat.TsonMapper; TsonMapper mapper = new TsonMapper(); // Serialize object to TSON String tson = mapper.writeValueAsString(user); // Deserialize TSON to object User user = mapper.readValue(tsonStr, User.class); // Convert JSON to TSON String tson = TsonConverter.fromJson(jsonStr); // Get savings report SavingsReport r = TsonConverter.savings(jsonStr); System.out.println(r.getSavedPercent() + "% saved");
tson-format/tson-php
Packagist · PHP 8.1+ · PSR-4 compliant
Beta
Install
composer require tson-format/tson-php
Usage — PHP
Encode, decode, convert
v1.0.0-beta
PHP
use TsonFormat\Tson; // Encode array to TSON $tson = Tson::encode(['name' => 'Alice', 'age' => 30]); // Decode TSON to array $data = Tson::decode("name: Alice\nage: 30"); // Convert from JSON $tson = Tson::fromJson($jsonString); // Convert from XML $tson = Tson::fromXml($xmlString); // Get token savings $report = Tson::savings($jsonString); echo $report['saved_pct'] . '% saved';
How It Works

Convert JSON or XML to TSON in 4 Steps

1

Paste Your Data

Copy your JSON or XML and paste it into the input area. Click "Load Example" to see a live conversion.

2

Customize Output

Select delimiter (comma, pipe, tab) and indentation. Options update TSON output in real time.

3

See Token Savings

The savings bar shows before, after, percentage saved, and estimated API cost reduction instantly.

4

Copy or Download

Copy to clipboard or download as a .tson file. All processing is local — your data never leaves your browser.

Why TSON

Built for the AI Era

Reduce API costs and optimize LLM token usage. The most efficient serialization format for GPT, Claude, and Gemini.

30–60% Token Reduction

Eliminates brackets, closing tags, repeated keys, and unnecessary quotes — the four biggest token drains in JSON and XML.

💰

Cut API Costs Significantly

Lower your GPT, Claude, and Gemini API costs by 30–60% on average. Immediate savings on every API call.

🔒

Your Data Stays Private

All conversion happens locally in your browser. Zero servers, zero logging, zero tracking. Guaranteed privacy.

🔄

Lossless Bidirectional

Convert to TSON for LLM prompts, back to JSON or XML when needed. Zero information loss in either direction.

🧠

Native LLM Readability

Indentation-based structure mirrors Python and Markdown — formats LLMs already parse natively and accurately.

📖

Open Standard

Fully open spec, MIT-licensed libraries. Any developer can implement a TSON parser in any language.

FAQ

Frequently Asked Questions

TSON (Token Serialized Object Notation) is a data notation format invented by Muhammad Yasir in 2026, designed natively for Large Language Models. It reduces token usage by 30–60% compared to JSON and XML by eliminating redundant syntax — repeated keys, closing brackets, mandatory quotation marks, and verbose tags.
TSON is significantly better for LLM prompts. JSON was designed for machine APIs, not AI inference. TSON's indentation-based structure is more natural for language models, and its columnar array mode eliminates the biggest token waste source — repeated key names across every object in an array.
Yes. TSON's indentation-based structure closely resembles Python and YAML — formats all major LLMs understand natively from training data. GPT-4, Claude, and Gemini all parse TSON accurately. You can also include a brief TSON spec snippet in your system prompt for maximum reliability.
It depends on your data structure. Uniform arrays of objects (the most common LLM data pattern) see the highest savings — typically 40–60%. Flat key-value objects see 20–35% savings. Deeply nested irregular structures see the least benefit. Use the live token counter in the converter to measure your exact data.
Yes, completely. Every TSON document converts back to JSON or XML with zero data loss. TSON is the prompt-layer format — use it when sending data to LLMs, convert back when you need JSON for storage or APIs.
Yes. All conversion logic runs entirely client-side in JavaScript. There are no servers, no data logging, no analytics on your inputs, and no account required. Your data never leaves your browser — guaranteed.
Yes, fully open. The complete TSON Specification v1.0 is published on this site and is freely available. You are welcome to build TSON parsers, converters, and libraries in any language. Attribution to the inventor Muhammad Yasir is appreciated but not required.
Start Saving Today

Ready to Reduce API Costs
with TSON Format?

Convert your JSON and XML to TSON now — completely free, no account required.