XML to JSON

Parse XML into formatted JSON. Attributes appear with an @_ prefix; a single child element becomes a string, multiple siblings become an array.

  • Runs entirely in your browser
  • No data stored or sent to a server
  • Free forever — no signup
  • Instant conversion

Input and Output

Use the interactive encoder and decoder on this page to process your text.

Learn more about XML to JSON conversion

How to Convert XML to JSON

XML to JSON

When to Convert XML to JSON

Parse XML API responses, RSS feeds, SOAP envelopes, and legacy config files into JSON for modern web applications, scripting, and JSON-native tooling.

Real-World Examples

SOAP response XML → JSON for browser inspection

RSS/Atom feed → JSON for a frontend aggregator

<item id="1"> → attribute preserved as @_id

Common Mistakes

  • Single-child elements vs arrays — one item may not become an array without configuration
  • Namespaces adding unexpected prefix keys in output
  • Text nodes mixed with child elements — review mixed content handling

Developer Tips

  • Format JSON output for readable inspection
  • Check attribute mapping (@_ prefix) before writing code against output
  • Validate XML is well-formed before converting

Frequently asked questions

How are XML attributes handled?

Attributes are preserved with an @_ prefix on the attribute name in the JSON output.

Are XML namespaces preserved?

Namespace prefixes may appear in element keys depending on the parser. Review output for your specific document.

Can I convert large XML files?

Very large documents may be slow in the browser. For huge files, use a streaming CLI XML parser.