My Tool Studio
Developer

XML to JSON

Inheriting a decade-old integration usually means XML: a supplier feed, a SOAP response, a CMS export full of attributes. This xml to json converter gets that data into the format your current stack prefers. Paste the document, press Convert to JSON, and elements become keys, attributes are preserved with an @_ prefix, and numeric or boolean text is typed automatically. The result comes back pretty-printed with a two-space indent, ready to read or feed straight to code. And when you'd rather the file never left your machine, that's covered: to convert xml into json here, your browser does all the parsing locally.

Always freeNo sign upRuns in your browser
Output appears here...

How to use

01

Paste the XML

A feed, an export, or a SOAP body all work. Try sample loads a short book element with an id attribute so you can see how attributes map.

02

Press Convert to JSON

The parser reads elements, attributes, and text, then prints typed JSON. You convert xml to json online without the detail being flattened away or uploaded anywhere.

03

Use the JSON

Copy the output into your code or a config. Attribute keys keep their @_ prefix, so you can always tell them apart from child elements.

Why XML to JSON

Common questions

What happens to XML attributes during the conversion?
They're kept, not dropped. An attribute like id="1" becomes a key named @_id alongside the element's other content, and attribute values get the same type detection as element text. If your downstream code dislikes the prefix, a single rename pass fixes it, which beats losing the data entirely.
Are numbers and booleans in the XML detected?
Yes. Text like 2026 or true is converted to a real number or boolean rather than arriving as a string, for attributes as well as elements. Watch out for values that only look numeric, like versions or postal codes; check those fields after converting.
How do I convert the JSON back to XML?
The JSON to XML page goes the other way, and it's the json to xml converter online people pair with this one for round trips. Note that the @_ attribute markers don't automatically become attributes again, so the return trip produces element-based XML.
Will it read a JavaScript object literal or a raw string?
No, the input here must be XML. For an object to json converter, or a string to json converter online when data arrives escaped, the JSON Formatter is the right starting point; it also serves as a general json converter online once your data is in JSON shape. Then come back here only if XML is actually involved.
Does it pretty-print, like an xml to json formatter?
Yes, the output is indented with two spaces rather than dumped on one line, so nested feeds stay readable. That's why some searches call this kind of tool an xml to json formatter: conversion and formatting happen in the same pass.
What's the size limit for converting big XML feeds?
Only your browser's memory. Multi-megabyte supplier feeds parse fine in practice; truly huge exports are better handled by a streaming parser in code. If the tab gets sluggish, split the feed and use this xml to json online for the section you're actually debugging.
Why use this instead of a general xml converter online?
General converters juggle many target formats and often mangle attributes or types along the way. This page is a dedicated xml to json converter online tuned for one conversion done properly: attributes kept, types inferred, output indented. When JSON is the destination, a focused tool gives you fewer surprises.

More Developer tools

View all