How to Convert XML to JSON (Step by Step)
Convert XML to JSON in your browser — step by step, with a free XML to JSON converter.
Turn XML into JSON for easier consumption in JavaScript and APIs:
-
1
Open the converter
Open the XML to JSON tool.
-
2
Paste your XML
Paste valid XML into the input.
-
3
Get JSON
Elements become objects and attributes are preserved by convention (e.g. @attributes). Copy the JSON.
Do it now
XML to JSON Converter
Convert XML to JSON in your browser. Native DOMParser with configurable attribute prefix, text key, and compact mode.
Open toolJSON to XML Converter
Convert JSON to XML in your browser. Configurable root element, attribute prefix, and text key.
Open toolXML Formatter
Beautify or minify XML using your browser's native parser. No dependencies, fast and accurate.
Open toolFrequently asked questions
How are XML attributes represented in JSON?
JSON has no attributes, so converters use a convention — commonly an "@attributes" key or "@"-prefixed keys — to keep them.