DT Dev Tools

TOON to XML

Convert TOON (Token-Oriented Object Notation) to XML online with a custom root element, indentation and declaration. Free, private and runs in your browser.

πŸ”’ Runs entirely in your browser β€” nothing is uploaded

Advertisement

Convert TOON data to XML

TOON (Token-Oriented Object Notation) is a token-efficient way to pass JSON-shaped data to large language models: indentation replaces braces, and uniform arrays of objects are written once as a table header like orders[2]{id,sku,qty}: plus one comma-separated line per row. Plenty of systems that receive that data, however, still expect XML β€” SOAP services, enterprise integration buses, RSS-style feeds, Android resources, Office and e-invoicing formats. This TOON to XML converter decodes the TOON with the official library and builds well-formed, indented XML in one step.

Objects become nested elements, each array item becomes a repeated element named after its key, and primitive values become element text with XML special characters escaped. Key names that are not valid XML names β€” ones that start with a digit or contain spaces β€” are sanitized automatically so the output always parses.

Root element, attributes and options

An XML document has exactly one root. When your TOON has a single top-level object key, that key is used as the root; otherwise everything is wrapped in the element named in Root element. To emit attributes, name keys with an @ prefix (for example "@id": 7), and use #text for an element's text content β€” the same convention as the XML to JSON and JSON to XML tools, so data can round-trip. Choose two spaces, four spaces or tabs for indentation, and drop the <?xml?> declaration when you are embedding a fragment.

Tips before using the XML

XML has no native types, so numbers and booleans are written as text; a schema (XSD) is what gives them meaning downstream. Keep Strict mode on so an LLM answer whose row count does not match its [N] header is rejected before it becomes a misleading document. Validate the result against the schema your receiver expects, and format or inspect it with the XML formatter. Need other targets? See TOON to JSON, TOON to YAML and TOON to CSV. Nothing is uploaded β€” the whole conversion happens on your device.

How to use

  1. Paste TOONPaste TOON (Token-Oriented Object Notation) text, or click Load sample.
  2. Set XML optionsChoose the root element name, indentation and whether to include the XML declaration.
  3. Copy the XMLCopy the XML or download it as a .xml file.

Frequently asked questions

How are TOON arrays converted to XML?
Each array item becomes a repeated element named after the array key, so users[2]{id,name}: produces two <users> elements, each with <id> and <name> children.
Why is there a root element?
XML needs exactly one root element. If the TOON document has a single top-level key, that key becomes the root; otherwise the data is wrapped in the root name you choose.
Can I produce XML attributes?
Yes. Keys starting with @ become attributes and #text becomes element text, matching the XML ⇄ JSON converters on this site.
Is my data uploaded?
No. Decoding and XML generation run entirely in your browser.
Advertisement