Skip to main content

XML to JSON

Convert XML to JSON online. Choose how attributes are written, force lists, and keep numbers as text or detect them. Free and private.

More options

XML

Stays in your browser

JSON

The result appears here after you press Convert.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to JSON Beautifier, JSON Visualizer or JSON to CSV.

Free Online XML to JSON

Paste XML and get JSON. You choose whether attributes appear with an @ prefix or merged beside the child elements, and whether single children are always lists. It gives developers a quick browser-based way to solve a focused xml to json task before moving the result into a project.

How to use XML to JSON

Paste your data into the box on the left, or open a file, then press Convert. Repeated sibling elements become a list. Text next to attributes is kept under the key #text.

Common mistakes

  • Pasting XML with more than one root element: XML allows only one, and the error shows the line.
  • Expecting namespaces to be removed: prefixed names such as ns:item are kept.

Frequently asked questions

Why would I always use lists?
An element that appears once is a single value, and one that appears twice is a list, so code that reads the JSON has to handle both. "Always use lists" makes the shape the same every time.
What about attributes and text in one element?
With the @ prefix, <p lang="en">hi</p> becomes {"@lang": "en", "#text": "hi"}.
Are comments and CDATA handled?
Comments are dropped. CDATA is read as ordinary text.
Is my data uploaded anywhere?
No. The conversion runs in your browser and nothing you paste or open is sent to a server.
How do I use this xml to json tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Formatters & Parsers

View all Formatters & Parsers tools →