Output will appear here
Output will appear here
Convert XML to JSON online with this free XML to JSON converter. The tool transforms XML documents into clean JSON objects, mapping elements to keys, attributes to prefixed properties, and repeated elements to arrays while preserving the full document structure.
Try Convert All - paste JSON once, see TypeScript, Go, YAML, and 15 more formats instantly.
Enter well-formed XML into the input editor. The converter handles elements, attributes, namespaces, CDATA sections, and mixed content nodes.
The right pane displays the converted JSON with XML elements mapped to objects, attributes prefixed with @, and text content stored in #text keys. Arrays are created for repeated sibling elements.
Click Copy to grab the JSON output or download it as a .json file. The output is valid JSON ready to be consumed by any API, database, or JavaScript application.
XML attributes are converted to JSON keys prefixed with @ by default. For example, <book id="1"> becomes {"book": {"@id": "1"}}. This convention separates attributes from child elements so the JSON structure is unambiguous.
When multiple sibling elements share the same tag name, the converter groups them into a JSON array. For example, three <item> elements inside a <list> become "list": {"item": [{}, {}, {}]} in the JSON output.
Yes. Namespace prefixes are preserved in the JSON keys, so <ns:element> becomes "ns:element" in the output. This prevents naming collisions when the same element name appears under different namespaces.
When an XML element contains both text and child elements, the text is placed in a #text key alongside the child element keys. This ensures no content is lost during conversion.
Yes. CDATA sections are unwrapped and their text content is placed directly into the corresponding JSON string value. Special characters within CDATA are properly escaped in the JSON output.