XML ↔ JSON Converter
Convert between XML and JSON formats
Convert XML
XML ↔ JSON
How to Use Convert
- 1 Paste XML or JSON in the input area
- 2 Select conversion direction (XML→JSON or JSON→XML)
- 3 View the converted output instantly
- 4 Copy or download the result
Input: <name>John</name>
Output: {"name": "John"}
Input: {"items": [1, 2, 3]}
Output: <items><item>1</item>...</items>
How are XML attributes converted to JSON?
Attributes are converted to object properties with an @ prefix. For example: <item id="1"/> becomes {"item": {"@id": "1"}}. You can customize this behavior.
Can I convert JSON arrays to XML?
Yes! Arrays are converted to repeated child elements. {"items": [1,2,3]} becomes <items><item>1</item><item>2</item><item>3</item></items>.
How do I handle XML namespaces in conversion?
Namespaced elements are converted with their prefix preserved. xmlns declarations are converted to special properties. The structure is maintained for round-trip conversion.
Is the conversion lossless?
Most conversions preserve data, but some XML features (like processing instructions, comments, mixed content) may not have direct JSON equivalents. Test with your specific data.
All processing happens locally in your browser. Your XML never leaves your device.