TOON to XML Converter

Input TOON

Output XML

Your XML appears here as you type.

Paste data to see token savings

Convert TOON to XML with our free online converter.

Example: TOON input and real XML output

The output below was generated by the same conversion code the converter uses, run on this sample when the page was built.

TOON input (207 characters)
directory:
  employees[4]{id,name,dept,salary,remote}:
    1,Alice Chen,Engineering,128000,true
    2,Bob Okafor,Sales,86000,false
    3,Carla Diaz,Engineering,119000,true
    4,Dan Weiss,Support,64000,false
XML output (633 characters)
<directory>
  <employees>
    <id>1</id>
    <name>Alice Chen</name>
    <dept>Engineering</dept>
    <salary>128000</salary>
    <remote>true</remote>
  </employees>
  <employees>
    <id>2</id>
    <name>Bob Okafor</name>
    <dept>Sales</dept>
    <salary>86000</salary>
    <remote>false</remote>
  </employees>
  <employees>
    <id>3</id>
    <name>Carla Diaz</name>
    <dept>Engineering</dept>
    <salary>119000</salary>
    <remote>true</remote>
  </employees>
  <employees>
    <id>4</id>
    <name>Dan Weiss</name>
    <dept>Support</dept>
    <salary>64000</salary>
    <remote>false</remote>
  </employees>
</directory>

XML output is 206% larger than the TOON input. The same data is 338 characters as minified JSON and 613 as pretty-printed JSON. Sizes are character counts, not tokens: token counts depend on the model's tokenizer (see the tokenizer comparison). Across larger datasets, TOON averages about 43% fewer tokens than JSON (42.6%) according to the official TOON benchmark.

TOON to XML: what changes

  • Reading TOON: TOON is strict about structure: the [N] in an array header must match the number of rows, and each row needs exactly as many values as the {field} list. Hand-edited TOON that breaks either rule fails to decode.
  • Writing XML: XML needs exactly one root element. Several top-level keys, or a top-level key holding an array, produce sibling roots that are not well-formed XML, which is why this sample is wrapped in a single key. Keys prefixed with @_ become attributes.

About TOON

TOON (Token-Oriented Object Notation) is an indentation-based format designed for LLM prompts. It uses about 43% fewer tokens than JSON on average (42.6% in the official TOON v4.1 benchmark), ranging from about 33% on mixed/nested structures to about 59% on flat uniform tables.

  • ✓About 43% fewer tokens than JSON on average
  • ✓Tabular rows for uniform arrays
  • ✓Lossless round trip to JSON
  • ✓Readable without tooling
Full TOON Documentation →

About XML

Extensible Markup Language is a verbose but powerful format. Still widely used in legacy systems, SOAP APIs, and document formats.

  • ✓Rich metadata
  • ✓Namespaces
  • ✓Validation schemas
  • ✓Legacy support
Full XML Documentation →

Why Convert TOON to XML?

Use XML when working with legacy systems, SOAP APIs, or when you need rich metadata and validation schemas.

TOON to XML: Frequently Asked Questions

How do I convert TOON to XML?

Paste your TOON into the editor on json2toon.co. The tool detects the input and produces XML instantly, then you copy the result. Conversion runs entirely in your browser, so nothing is uploaded to a server.

Is the TOON to XML converter free?

Yes. Converting TOON to XML on json2toon.co is free with no account, signup, or usage limit. A free public API is also available for automated, programmatic conversion.

Why convert TOON to XML?

Convert TOON to XML with our free online converter.

What should I watch out for when converting TOON to XML?

XML needs exactly one root element. Several top-level keys, or a top-level key holding an array, produce sibling roots that are not well-formed XML, which is why this sample is wrapped in a single key. Keys prefixed with @_ become attributes.

Is my data safe when I convert TOON to XML?

Yes. The TOON to XML conversion happens client-side in your browser. Your source data stays on your device and is never sent to or stored on a server, which makes it safe for private or sensitive payloads.