← All tools
// DEVELOPER

XML to JSON online

Convert XML to JSON format — free, browser-based, no data sent to server.

XML to JSON logo
by
CHUNKY
MUNSTER
XML → JSON

XML to JSON Notes

How to Use the XML to JSON Converter

  1. Paste or enter your input into the text field.
  2. Configure any options (format, delimiter, encoding, or mode) using the controls above the output.
  3. The result updates instantly — no submit button required for most operations.
  4. Click Copy or Download to take the output to your next step.

Convert XML to JSON for use in modern JavaScript, REST APIs, and document stores. The converter parses the XML with the browser’s DOMParser, then walks the tree: each element becomes an object keyed by its tag name, attributes become @-prefixed properties, and repeated child elements collapse into JSON arrays.

How the XML to JSON Converter Works

When an element has both attributes and text content, the text lives under #text alongside the @-prefixed attribute keys (the standard convention used by libraries like xml2js). Output can be pretty-printed for readability or minified to save bytes. Useful for migrating SOAP/RSS feeds into JSON-based pipelines without writing custom parsing code.

Frequently Asked Questions

How are repeated children represented?

Two or more siblings with the same name become a JSON array; a single child remains a plain key. Force-array mode keeps every child as an array even when there’s only one — useful when downstream code expects consistent shapes.

How are attributes represented in JSON?

Each attribute becomes a key prefixed with @ (e.g. {"@id": "3"}). When an element has both attributes and text content, the text lives under the #text key alongside the attribute entries.

Are XML namespaces preserved?

By default the prefix is included in the key (e.g. "ns:tag"). You can choose to strip namespace prefixes if your downstream consumer doesn’t need them.

Is the XML sent anywhere for parsing?

No — parsing uses the browser’s built-in DOMParser and the conversion is local JavaScript.

Explore the full suite of DEVELOPER tools and 290+ other free utilities at Chunky Munster.