XML to JSON Converter

Paste XML and convert it to clean JSON — with configurable attribute/text keys, array handling, namespace mode, CDATA mode, and optional type inference. The Round-trip tab flags where the conversion is lossy (attribute+text, mixed content, repeated siblings), and the JSON → XML tab re-renders the result for comparison. Runs in your browser; nothing is uploaded.

Guide

Auto-converts as you type. Ctrl+Enter to re-run.

Advanced options

How to use the XML to JSON Converter

Turn XML into readable JSON locally so it fits the rest of your API debugging workflow — without leaking sensitive data to a third-party service. For SOAP-envelope scoping (Body / Fault) and XPath selection, use the XML / XPath / SOAP Inspector.

When to use it

How it works

  1. Paste the XML into the input.
  2. Adjust the attribute prefix, text key, arrays, namespaces, CDATA, and type inference options.
  3. Read the verdict and open the Round-trip tab to see where the conversion is lossy.
  4. Copy or download the JSON, or hand it off to the JSON Formatter or JSONPath Tester.

Tips & pitfalls

Frequently asked questions

Does this tool upload my XML?

No. All parsing, conversion, namespace handling, and reporting run entirely in your browser. Nothing is sent to any server.

How are XML attributes converted to JSON?

By default, attributes are placed under @-prefixed keys (e.g. @id, @currency). You can change the prefix with the Attribute prefix option.

How are repeated XML elements converted to arrays?

Repeated sibling elements automatically become JSON arrays. Single-occurrence elements stay as objects unless you switch Arrays to Force all.

How are XML namespaces handled?

Choose between preserving prefixes in JSON keys or stripping them with the Namespaces option.

Where did SOAP scoping and XPath go?

SOAP-envelope scoping (Body / Fault) and XPath selection live in the XML / XPath / SOAP Inspector; this converter focuses on whole-document XML to JSON.

What happens to CDATA and comments?

By default CDATA is treated as text and comments are dropped. Switch CDATA mode to Separate to keep CDATA under a #cdata key.

Why is XML to JSON not always reversible?

XML and JSON have different data models. Attributes, mixed content, element order, comments, and namespaces have no native JSON equivalent, so full round-tripping is not guaranteed — the Round-trip tab flags where it would be lossy.

How do I preserve leading zeros in IDs?

Keep type inference off (the default). With inference on, values like 00123, IDs beyond JavaScript safe-integer precision, UUIDs, and date-like strings still stay as strings.

Runs locally in your browser. No uploads.

Related guides