When to use this
Convert SOAP responses, RSS, Maven POMs and Android manifests into JSON fixtures for tests and APIs that no longer speak XML.
This page is a focused view of theJSON ↔ XML Converter, which has the full set of options.
Paste XML to convert it to pretty-printed JSON in this tab. Elements become objects, repeated tags become arrays, and attributes become keys prefixed with @_. Comments and the XML declaration drop because JSON has no syntax for them. Use it for SOAP, RSS and Maven POMs. Nothing is uploaded.
Runs in this tab · nothing is uploaded · Verify in 10 seconds →
XML → JSON parses the document in this tab and emits pretty-printed JSON. Elements become objects, repeated sibling tags become arrays, attributes become keys prefixed with @_, and text nodes become values. The sample below is already converted so you can see the mapping.
The @_ convention is the de-facto interchange used by fast-xml-parser: <book id="bk101"> becomes {"book":{"@_id":"bk101",…}}. A round trip XML→JSON→XML can drop comments, CDATA and the XML declaration because JSON has no syntax for them, and a single child cannot be told apart from a one-item list.
If conversion fails, the status names the first well-formedness error with line and column. Fix the XML first (unclosed tag, raw &, two roots). If the JSON looks “too nested”, the source used wrapper elements for lists; that is faithful, not a bug.
Convert SOAP responses, RSS, Maven POMs and Android manifests into JSON fixtures for tests and APIs that no longer speak XML.
This page is a focused view of theJSON ↔ XML Converter, which has the full set of options.
As keys prefixed with @_. <book id="bk101"> becomes {"@_id":"bk101"} on the book object.
Not always. Comments, processing instructions, CDATA wrappers and the XML declaration drop because JSON has no equivalent.
No. Conversion runs in this tab.
Sibling elements with the same name become a JSON array, in document order.
Yes. Use JSON → XML on the same tool. @_ keys become attributes again.
Text that looks numeric may still be emitted as a string or coerced to a number depending on the parser. Check the JSON before treating it as typed data.