XML ⇄ JSON Converter
Convert XML to JSON and JSON to XML with attributes preserved. Handles repeated tags as arrays. Runs in your browser. Free.
💡 How to use
- XML → JSON turns elements into keys; repeated tags become arrays. Attributes are stored under
@attributes. - JSON → XML rebuilds elements from your JSON object (single root recommended).
- Runs entirely in your browser — nothing is uploaded.
Free XML to JSON & JSON to XML Converter
Convert XML to JSON and JSON back to XML instantly in your browser. Paste your data, pick a direction, and get clean, indented output — with element attributes preserved. Free, no sign-up, and nothing is uploaded.
What this tool does
XML and JSON are the two most common formats for structured data, and you often need to move between them — for example when a legacy API returns XML but your app expects JSON. This converter parses your input, maps the structure faithfully, and prints readable, indented output in the other format, both directions.
How to use it
It is instant:
- Paste XML or JSON into the input box.
- Choose the direction: XML → JSON or JSON → XML.
- Toggle whether to keep XML attributes.
- Click Convert, then copy the result.
How the mapping works
Going from XML to JSON, each element becomes a key and its text becomes the value. When a tag repeats (like several <item> elements), it becomes a JSON array so nothing is lost. Attributes are stored under an <code>@attributes</code> object, and mixed text is kept under <code>#text</code>. Going from JSON to XML, keys become elements, arrays expand into repeated tags, and <code>@attributes</code> is written back as real attributes.
Attributes and edge cases
XML has features JSON does not, such as attributes, namespaces, and mixed content, so the conversion uses simple, predictable conventions (<code>@attributes</code> and <code>#text</code>) to represent them. For JSON → XML, a single top-level key works best because XML needs exactly one root element. If your JSON has multiple top-level keys, the tool wraps them in a <code><root></code> element.
Common uses
Developers use this to consume XML APIs (SOAP, RSS, sitemaps) in JavaScript, to migrate configuration or data files between systems, to prepare fixtures for tests, and to make XML easier to read by viewing it as JSON. It is also useful for quickly understanding an unfamiliar XML schema by seeing its JSON shape.
Privacy
The conversion runs entirely in your browser using the built-in parser and JSON engine — your data is never uploaded, logged, or stored. That makes it safe for private configs, internal API payloads, and any data you would not paste into a service that sends it to a server.
FAQ
Is this converter free?
Is my data uploaded?
How are repeated XML tags handled?
What happens to XML attributes?
Why does JSON to XML need a single root?
Does it validate my input?
Does it keep namespaces?
Related tools
Pro tip: pair this tool with Upside Down Text Generator and What is My Browser for a faster SEO workflow.