XML and JSON Converter
Turn XML into JSON and JSON into XML in your browser. Attributes, repeated elements, and element text are kept, errors in the XML are reported, and nothing is uploaded.
0 characters · 2,000,000 remaining
0 characters
Paste XML or JSON above and the result appears here, converted in your browser.
On this device
No signup. Your input is never uploaded.
How to use the XML and JSON Converter
Choose XML to JSON or JSON to XML.
Paste your data, or load the example.
Choose the indentation, and whether to keep attributes. For JSON to XML, set the root element.
Copy the result, or download it as a file.
Questions about the XML and JSON Converter
Attributes become keys that start with @, for example @id. Text that sits beside attributes or child elements goes under the key #text. Turn off Keep attributes to leave attributes out.
Elements with the same name inside one parent become a JSON list, so three item elements become an item list with three entries.
Use keys that start with @ for attributes and #text for an element's own text. If the JSON has a single top-level key, it becomes the root element. Otherwise it is wrapped in the root element name you choose.
Comments and processing instructions are not kept, and an empty element becomes null. If the XML is not well formed, the tool says what is wrong.