XML → JSON

Parse XML to JSON. Attributes become @attr keys, repeated elements become arrays.

Convert XML to JSON online: instant, browser-based, and private

XML remains the backbone of countless enterprise systems, SOAP APIs, RSS feeds, SVG graphics, and configuration standards. But modern application code almost always prefers JSON for its compactness and ease of use with JavaScript. This tool converts XML to JSON instantly, right in your browser, so you can work with the data in the format your code expects.

The converter preserves the full element hierarchy, includes attribute data, and handles text content. The output is pretty-printed JSON that you can copy directly into your codebase, API client, or data processing pipeline.

Step-by-step guide

  1. 1
    Paste your XML
    Enter or paste well-formed XML into the input panel. Any valid XML document or fragment is accepted.
  2. 2
    View the JSON output
    The converter parses the XML structure and produces equivalent JSON in real time.
  3. 3
    Check element and attribute mapping
    XML elements become JSON object keys. Attributes are included as properties on the corresponding object.
  4. 4
    Handle text nodes
    Text content inside elements is preserved as a string value. Mixed content (text plus child elements) is represented with a text property.
  5. 5
    Copy the JSON
    Click Copy to put the formatted JSON output on your clipboard.

Related Tools

Frequently Asked Questions

How are XML attributes converted to JSON?
XML attributes are included as properties on the JSON object for that element, typically prefixed with @ to distinguish them from child elements. This varies slightly by conversion convention.
How are XML namespaces handled?
Namespace prefixes are preserved in the key names (e.g. ns:element becomes a key string). The namespace declarations themselves may be included as attribute-style properties.
What happens to XML comments?
XML comments are stripped from the JSON output as JSON has no equivalent construct.
Can this tool parse large XML files?
Yes. Since the conversion runs in your browser there is no server-imposed size limit. Very large documents may take longer depending on your device's processing power.
How is text content with child elements handled?
Mixed content (an element with both text and child elements) is represented with a special text property alongside the child element properties.
Is the JSON output pretty-printed?
Yes. The output is formatted with indentation for readability.
Can I convert JSON back to XML?
Yes. Use the JSON to XML tool on AlteredIdea to reverse the conversion.
Is my XML data sent to a server?
No. All processing happens in your browser. Your data is never transmitted or stored.
Is this tool free?
Yes, completely free with no account, no sign-up, and no usage limits.

AlteredIdea vs alternatives

vs server-side converters: AlteredIdea converts in your browser: your data never leaves your device.

vs writing scripts: Instant results, no coding needed.

vs paid tools: Completely free, no account required.