XML ↔ JSON Converter
Free online XML and JSON converter tool
About XML/JSON Converter
Converts between XML and JSON in both directions using a predictable attribute convention. XML attributes become JSON keys prefixed with @ (for example @id), mixed text content lands under #text, and repeated child tags collapse into arrays while single children stay as objects. JSON-to-XML reverses those rules and emits a UTF-8 XML declaration.
How to Use
1. Toggle the mode tab to XML to JSON or JSON to XML. 2. Paste the source into the input box (the placeholder shows the expected shape for the active mode). 3. Click Convert. 4. Copy the result from the output box. Switching modes clears the previous output and any error.
Conversion Conventions
XML -> JSON: the root element becomes the top-level object key; attributes are stored as @name; text-only leaves become plain strings; siblings with the same tag become an array; mixed content uses #text. JSON -> XML: any key starting with @ becomes an attribute, #text becomes inline text, arrays repeat the parent tag, and XML special characters (&, <, >, ", ') are escaped automatically.
▶How are XML attributes represented in the JSON?
▶What does #text mean?
▶What happens with invalid XML or JSON?
▶Are repeated tags turned into arrays?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee