XML ⇄ JSON
Convert XML to JSON and JSON back to XML in your browser, with attribute prefix, CDATA and pretty-print options.
🔒 Runs in your browser — files never leave your deviceFree · No sign-up
XML input
Drop an .xml / .json file, or click to choose
JSON output
How to use the XML ⇄ JSON converter
- Choose a direction, then paste your document or drop an
.xml/.jsonfile into the box. - Set how attributes are handled — the prefix (
@_by default) keeps them apart from child elements, or switch them off entirely. - Read the result on the right, then copy it or download
data.json/data.xml.
FAQ
Why do attributes get a prefix?
An XML element can have an attribute and a child element with the same name. Writing attributes as @_id keeps both in one JSON object without a clash — and the same prefix is read back when you convert JSON to XML, so a round trip survives.
What happens to CDATA, namespaces and empty tags?
CDATA becomes plain text, namespace prefixes are kept as part of the element name (soap:Body), and an empty element becomes an empty string — which is written back as a self-closing tag.
Are repeated elements turned into arrays?
Yes. Two or more siblings with the same name become a JSON array. If your consumer always expects arrays, turn on “Always use arrays for children”.