Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>JSON to TOON by RohitNew to Visual Studio Code? Get it now.
JSON to TOON by Rohit

JSON to TOON by Rohit

Rohit Kumar

|
1 install
| (0) | Free
Transform JSON files into compact TOON format — fewer tokens, full readability. Perfect for AI context, diffs, and config review.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JSON → TOON Converter

Transform verbose JSON into compact TOON format — up to 55% fewer tokens, full readability. Built for AI context windows, code review, and config inspection.


What is TOON?

TOON (Token-Optimized Object Notation) is a human-readable, compact alternative to JSON. It strips structural noise — quotes, brackets, repeated keys — while keeping every value intact.

Format Characters Est. Tokens
JSON 665 ~92
TOON 237 ~41

Same data. 55% fewer tokens.


Real-World Example

Input JSON (API response — 665 chars, ~92 tokens):

{
  "company": "Acme Corp",
  "founded": 1998,
  "active": true,
  "employees": [
    {
      "id": 1001,
      "name": "Alice Chen",
      "department": "Engineering",
      "salary": 95000,
      "active": true
    },
    {
      "id": 1002,
      "name": "Bob Smith",
      "department": "Sales",
      "salary": 75000,
      "active": false
    },
    {
      "id": 1003,
      "name": "Carol Ray",
      "department": "Design",
      "salary": 82000,
      "active": true
    }
  ],
  "address": {
    "city": "London",
    "zip": "EC1A 1BB",
    "country": "UK"
  }
}

TOON Output (237 chars, ~41 tokens):

company: Acme Corp
founded: 1998
active: true
employees[3]{id,name,department,salary,active}:
  1001,Alice Chen,Engineering,95000,true
  1002,Bob Smith,Sales,75000,false
  1003,Carol Ray,Design,82000,true
address:
  city: London
  zip: EC1A 1BB
  country: UK

TOON Format Rules

1. Primitive key-value

JSON:

{ "name": "Alice", "age": 30, "verified": true }

TOON:

name: Alice
age: 30
verified: true

2. Uniform object array → table format

JSON:

{
  "users": [
    { "id": 1, "name": "Alice", "role": "admin" },
    { "id": 2, "name": "Bob",   "role": "viewer" },
    { "id": 3, "name": "Carol", "role": "editor" }
  ]
}

TOON:

users[3]{id,name,role}:
  1,Alice,admin
  2,Bob,viewer
  3,Carol,editor

The header key[count]{col1,col2,...}: defines the schema once. Each row is a compact comma-separated line — no repeated keys.


3. Primitive array

JSON:

{ "tags": ["api", "v2", "stable", "public"] }

TOON:

tags[4]: api,v2,stable,public

4. Nested object

JSON:

{
  "config": {
    "timeout": 30,
    "retries": 3,
    "debug": false
  }
}

TOON:

config:
  timeout: 30
  retries: 3
  debug: false

5. Null values

null is represented as - to save space:

JSON:

{ "firstName": "Alice", "middleName": null, "lastName": "Chen" }

TOON:

firstName: Alice
middleName: -
lastName: Chen

6. Empty array

JSON:

{ "permissions": [] }

TOON:

permissions[0]:

Features

  • One-click conversion — CodeLens link above every JSON file
  • Live stats — lines, characters, and estimated token savings
  • Syntax highlighting — keys, values, booleans, nulls, and schema columns all colour-coded
  • Copy to clipboard — paste TOON directly into any AI chat
  • Save as .toon — export the converted file
  • Wrap lines toggle — for long values
  • Right-click support — convert from the editor or Explorer panel

How to Use

Option 1 — CodeLens (inline)

Open any .json file. A → Convert to TOON link appears above the first line. Click it.

Option 2 — Right-click menu

Right-click any .json file in the editor or Explorer panel → Convert to TOON.

Option 3 — Command Palette

Press Cmd+Shift+P (Mac) / Ctrl+Shift+P (Windows) → type Convert to TOON.


Stats Panel

After converting, the panel shows three stat cards:

Card What it shows
Lines Original vs TOON line count + % reduction
Characters Character count (excluding newlines) + % reduction
Est. Tokens Estimated LLM token count + % reduction

Token estimation uses ~3 chars per token — the empirical average for structured data in BPE tokenizers (GPT-4, Claude, Gemini, etc.).


Why TOON?

When you paste JSON into an AI assistant (ChatGPT, Claude, Copilot), every character costs tokens from your context window. Large JSON configs, API responses, or data files can consume thousands of tokens just in structure overhead — quotes, brackets, repeated keys.

TOON eliminates that overhead:

  • No repeated key names in arrays
  • No surrounding quotes on keys
  • No {, }, [, ] brackets for tabular data
  • Schema defined once at the top

The AI still understands the data — it's just far more compact.


Output Panel Shortcuts

Action How
Copy TOON Click the Copy button
Save as file Click Save as .toon
Toggle line wrap Toggle the Wrap lines switch

Requirements

  • VS Code 1.85.0 or higher
  • A .json or .jsonc file

Release Notes

1.0.1

  • Updated extension icon
  • README with full format guide and real-world examples

1.0.0

  • Initial release
  • Uniform object arrays rendered as compact table format
  • Primitive arrays, nested objects, bullet lists supported
  • Live stats: lines, characters, estimated tokens
  • Syntax highlighting with VS Code theme integration
  • Copy to clipboard and Save as .toon
  • CodeLens, right-click menu, and Command Palette support

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft