Skip to main content

Data Tools

XML to JSON

Convert XML data to JSON format. Free online tool — runs in your browser, no sign-up required.

See how to use this tool

XML to JSON

Data is converted locally in your browser without server upload.

Privacy: your input is processed only in this browser. Refreshing clears the current state.

About XML to JSON

ToolConv's XML-to-JSON converter parses an XML document into a JSON object in your browser using a fast SAX-style parser. Elements become object properties, repeated elements become arrays, text content is captured under a configurable key, and attributes are distinguished from child elements by a prefix — so the round-trip back to XML (if needed) stays unambiguous.

Because parsing is local, SOAP responses, configuration files, and legacy-system data feeds never leave your device. You can control whether to trim whitespace-only text nodes, whether to coerce numbers and booleans, and how to represent mixed content — three settings that cover the vast majority of real-world XML.

How to use it

  1. 1Paste XML or drop in an .xml file.
  2. 2Choose how attributes are prefixed (default: @).
  3. 3Set the text-content key name (default: #text).
  4. 4Toggle 'trim whitespace' and 'coerce types' as needed.
  5. 5Click Convert and download the JSON.

When to use it

  • ✓Parsing a SOAP response into JSON for a modern JavaScript client.
  • ✓Converting an XML config file into JSON for a Node.js application.
  • ✓Turning an RSS/Atom feed into JSON for a feed-reader front end.
  • ✓Migrating legacy XML data into a JSON-based document database.

Features

  • •SAX-style parser handles large XML without building a huge DOM.
  • •Configurable attribute prefix and text-content key.
  • •Optional whitespace trimming and type coercion.
  • •Repeated elements auto-detected and converted to arrays.

Related tools

FAQ

How are XML attributes distinguished from elements?

Attributes are prefixed with a configurable marker (default '@'), so <user id='5'> becomes { "user": { "@id": "5" } } — keeping attributes and child elements clearly separable.

How are repeated elements turned into arrays?

When the parser sees the same child tag name more than once, it automatically collects them into a JSON array rather than overwriting — so <items><item/><item/></items> becomes an array of two items.

Is my XML uploaded?

No. Parsing and JSON generation run entirely in your browser; SOAP responses and config files stay on your device.

What about mixed content (text and child elements together)?

Mixed content is the hardest XML pattern for JSON. We capture text runs under the text-content key and child elements as properties, preserving order via a parallel array if you enable 'preserve mixed content order'.

Will numbers and booleans be converted automatically?

Only if you enable 'coerce types'. Without it, all values are strings; with it, numeric and boolean-looking text nodes become numbers and booleans respectively.

Does it handle XML namespaces?

Namespaces are preserved as part of the element name (e.g., ns:element) rather than expanded to full URIs, which keeps the JSON readable. For full namespace expansion, post-process the output or use a dedicated XML library.