JSON ⇄ XML
Convert between JSON and XML formats
100% free. Runs entirely in your browser - your files and data never leave your device and nothing is uploaded to any server.
Drop a JSON or XML file, click to browse, or paste
JSON, XML · up to 5 MB · never uploaded
About this tool
JSON and XML both describe nested data, but they are not equivalent, and the differences are what make conversion interesting. XML elements can carry attributes; JSON objects cannot. XML has no arrays - repetition is just the same tag appearing twice - while JSON distinguishes a one-item array from a bare value. XML has no types at all, so every value arrives as text. This converter handles the common case well: it turns JSON objects into nested elements, escapes characters that would break the markup, and collapses repeated XML tags back into JSON arrays. Where it is deliberately simple is attributes - converting XML to JSON reads element content and ignores attributes, so if your source keeps real data in attributes rather than child elements, you will need to move it first. That covers most API payloads and config files; it does not cover attribute-heavy document XML. Everything is converted in your browser.
Clean up and validate API data
- 1Format the JSONMake it readable and catch syntax errors.Open
- 2Convert if neededMove between JSON, XML, YAML or CSV.You are here
- 3Compare versionsSee exactly what changed.Open
- 4Test the requestSend it and inspect the response.Open
How to use this tool
- Pick a directionJSON to XML, or XML to JSON. The swap button feeds the output back as input to check a round trip.
- Paste your dataBoth sides validate as you convert - malformed input reports a parse error rather than producing wrong output.
- Review the structure, not just the syntaxCheck arrays and any attributes specifically, since these are where the two formats genuinely disagree.
- Copy the resultFix up types and attributes by hand if the target system needs them.
What changes between JSON and XML
XML has attributes and JSON does not, so attributes are mapped to specially named keys. XML has no arrays - a repeated tag stands for a list - so a list with one item can come back as a single value. Everything in XML is text, so numbers and booleans may return as strings.
JSON keys that are not valid XML tag names, such as keys starting with a digit or containing spaces, are adjusted so the XML stays well-formed.
Key features
- Handles the awkward parts: XML escaping, repeated tags becoming arrays, and nested objects becoming nested elements.
- Reports parse errors instead of silently emitting broken output.
- Swap converts in the opposite direction so you can inspect a round trip immediately.
- Runs entirely in your browser - useful because API payloads usually contain real customer data.
- No upload, no account, no size limit beyond your own memory.
Common uses
- Feeding a legacy SOAP or enterprise XML response into a modern JSON codebase.
- Converting a JSON fixture into XML to test an older integration.
- Turning an RSS or sitemap fragment into JSON to inspect it.
- Reformatting config between an XML-based tool and a JSON-based one.
- Making an XML payload readable by viewing it as JSON.
Tips for better results
- If your XML keeps data in attributes, rewrite them as child elements before converting - attributes are not read.
- Remember every value from XML comes back as a string. "42" and "true" will need converting to number and boolean yourself.
- A JSON array with exactly one item does not survive the round trip: it becomes a single element, which reads back as an object rather than an array. Handle that in code if it matters.
- JSON keys containing spaces, dots or other characters illegal in XML tag names are replaced with underscores, since the alternative would be invalid XML.
- Convert a small representative sample first and check the shape before running your whole dataset through.
Mistakes to avoid
- Expecting XML attributes to appear in the JSON output - only element content is read, so attribute data is dropped.
- Assuming types survive. XML has no type system, so numbers and booleans return as strings.
- Relying on an exact round trip for single-item arrays, which XML cannot represent distinctly.
- Sending confidential payloads through a server-based converter when this one does not need to - check where any online converter runs before pasting production data.
- Ignoring namespaces: prefixed tag names come through as part of the key, so a namespaced document needs review rather than blind conversion.
Frequently asked questions
No. XML to JSON reads element content only, so attributes are not included in the output. If your data lives in attributes, restructure them as child elements first. This keeps the output predictable for API payloads and config files, where nested elements are the norm.
For nested objects and multi-item arrays, yes in structure. Two things change: all values come back as strings because XML is untyped, and an array with a single item comes back as an object, because a lone repeated tag is indistinguishable from a plain child element.
Prefixed tag names such as soap:Body come through with the prefix as part of the JSON key. The xmlns declarations themselves are attributes, so they are not carried over - a heavily namespaced document will convert, but review the result rather than trusting it blindly.
Characters that XML does not allow in a tag name - spaces, dots, slashes - are replaced with underscores, because emitting them literally would produce XML that no parser can read.
No. Conversion happens in your browser using its built-in XML parser, so payloads containing customer records never leave your device.
Usually an unclosed tag, a stray ampersand that should be &, or more than one root element - XML permits exactly one. The error message comes from the browser's own parser, which is strict by design.
XML has no array type, so one <item> looks the same as a lone value. When converting back to JSON, a list with one element can come out as an object - check those fields and wrap them in an array where your code expects one.
SOAP web services, RSS and Atom feeds, sitemaps, Microsoft Office file internals, SVG graphics, invoicing standards such as UBL and many banking and government data exchanges.
XML stores everything as text, so 42 and true come across as strings unless the converter guesses types. Check numeric and boolean fields after converting to JSON before feeding the result to code that expects real types.