XML to JSON Converter
Convert XML to JSON and JSON back to XML, with attributes preserved and validation as you type — all in your browser.
XML and JSON, both ways
Plenty of legacy APIs, RSS feeds, sitemaps and config files still speak XML, while modern code prefers JSON. This converter translates between the two without losing structure: nested elements become nested objects, and attributes are kept so nothing is dropped on the way through.
How to use it
- Pick a direction — XML → JSON or JSON → XML.
- Paste your markup on the left, or load the sample.
- Copy the result on the right, or Swap to feed it back in.
Frequently asked questions
How are XML attributes handled?
Attributes are kept and given an "@_" prefix in the JSON, so <note id="1"> becomes "@_id": "1". Converting that JSON back to XML restores the attribute, so a round trip preserves your data.
Does it validate my XML?
Yes. Before converting, the XML is checked for well-formedness. If a tag isn't closed or the structure is broken, you get the error message and approximate line instead of malformed output.
Can it convert JSON back into XML?
Yes — switch the direction to JSON → XML. Keep the "@_" prefix on any keys you want to become attributes, and use the Swap button to round-trip a result straight back through.
Is my data sent anywhere?
No. Parsing and building happen entirely in your browser with the fast-xml-parser library, so your documents never leave your device.