SEOlust logo SEOlust
Developer & Utilities

XML ⇄ JSON Converter

Convert XML to JSON and JSON to XML with attributes preserved. Handles repeated tags as arrays. Runs in your browser. Free.

All tools

💡 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 &lt;item&gt; 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>&lt;root&gt;</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?
Yes. It is completely free, runs in your browser, and needs no account or sign-up.
Is my data uploaded?
No. Both XML → JSON and JSON → XML happen locally in your browser, so nothing leaves your device.
How are repeated XML tags handled?
When an element appears more than once, it is converted into a JSON array so every occurrence is preserved.
What happens to XML attributes?
Attributes are stored under an @attributes object in the JSON, and written back as real attributes when converting JSON to XML. You can also turn attribute handling off.
Why does JSON to XML need a single root?
XML documents must have exactly one root element. If your JSON has one top-level key it becomes the root; if it has several, the tool wraps them in a <root> element.
Does it validate my input?
Yes. Malformed XML or invalid JSON is reported with an error message instead of producing broken output.
Does it keep namespaces?
Namespaced element and attribute names are preserved as written. JSON has no formal namespace concept, so prefixes are kept as part of the key name.

Related tools

Pro tip: pair this tool with Upside Down Text Generator and What is My Browser for a faster SEO workflow.