Convert XML data to JSON online in your browser. Paste XML or open an .xml file, choose how attributes and text nodes are represented, and download or copy the formatted JSON output. Repeated elements can be represented as arrays according to the converter's mapping rules.
Paste XML directly into the editor or open a .xml file from your device. The input is parsed in the browser before the JSON output is generated.
Copy the converted JSON to your clipboard or download it as a .json file for use in APIs, scripts, frontend applications, and data-processing workflows.
Choose the JSON indentation, configure the prefix used for XML attributes, and control whether text content is preserved under a dedicated text key.
Represent XML attributes as JSON properties with a configurable prefix such as @ or @_. A prefix helps distinguish attributes from child elements with similar names.
Convert nested XML elements into nested JSON objects and represent repeated sibling elements as arrays where the parser's mapping rules identify them as repeated values.
Preserve element text under a dedicated key when an element contains both attributes and text. This helps avoid losing information in mixed XML structures.
XML parsing and JSON generation happen in your browser. The page does not require an account or upload the XML to a remote conversion service.
Paste a well-formed XML document into the input editor or open a .xml file from your device. You can use an API response, configuration document, or XML export.
Select the JSON indentation, choose an attribute prefix, and decide whether element text should be preserved under a dedicated text key.
Click Convert to JSON to parse the XML tree and generate a JSON representation. If the XML is malformed, review the parser error and correct the source document.
Check attributes, text values, repeated elements, namespaces, and nested structures in the output. Copy the JSON or download it as a .json file.
<user id="42"> <name>Alice</name> <age>30</age> </user>
{
"user": {
"@id": "42",
"name": "Alice",
"age": "30"
}
}An XML to JSON converter parses an XML document and creates a JSON representation of its elements, attributes, text, and repeated structures. This can make XML data easier to inspect and use in JavaScript applications, APIs, scripts, and modern data-processing workflows.
XML and JSON do not have identical data models. XML distinguishes elements, attributes, namespaces, text nodes, comments, processing instructions, ordering, and mixed content, while JSON represents objects, arrays, strings, numbers, booleans, and null. A converter therefore needs mapping conventions, and the result may not be a lossless reproduction of every XML feature.
@id or @_id.#text.XML permits an element to contain both attributes and text:
<name priority="high">Alice</name>A common JSON representation is:
{"name":{"@priority":"high","#text":"Alice"}}The exact keys depend on the converter's configuration. A configurable attribute prefix helps prevent collisions between an attribute and a child element with the same name. A dedicated text key helps preserve text content when a simple string value is not enough.
When several sibling elements share the same tag, a converter can represent them as a JSON array:
<items>
<item>A</item>
<item>B</item>
</items>One challenge is the difference between a single element and a repeated element. Some converters return a scalar or object for one occurrence and an array only when multiple occurrences exist. Other converters force selected element names to always use arrays. Check the output shape if your application expects a stable schema.
XML namespaces do not have a direct JSON equivalent. A converter may preserve prefixes in property names, remove prefixes, or expose namespace declarations separately. CDATA markers are usually removed while their content is retained as text. Mixed content, where text appears between child elements, can be difficult to represent without preserving order explicitly.
For SOAP, SVG, SAML, RSS, Atom, or other namespace-heavy documents, test a representative sample and verify that the output retains the information your application actually needs.
Converting XML to JSON and then converting the result back to XML may produce a structurally similar document, but not necessarily the original document. Comments, whitespace, attribute order, namespace declarations, CDATA markers, document formatting, and mixed-content order may change or disappear. Keep the original XML if exact reconstruction matters.
&.This converter is designed to parse XML and generate JSON in the browser instead of sending the source document to a remote conversion service. That can be useful for development data and private integration samples. It is not a substitute for secure secret management, so avoid entering credentials, tokens, private customer information, or production secrets into any online converter.
A browser-based converter is convenient for one-off transformations and inspection. For repeatable automation, very large files, confidential documents, CI pipelines, or strict schema requirements, use a trusted local library or command-line tool and define the XML-to-JSON mapping explicitly.