Skip to content

XML to JSON

Convert XML documents and feeds into JSON.

  • 100% Free
  • No Sign Up
  • Works in Your Browser

XML to JSON

Convert XML into JSON

More Developer Tools

View all tools

Every everyday developer tool, right in your browser.

No installs. No uploads. No signup.

Browse all 36 tools
Developer tools
36
Cheat sheets
10
Bytes uploaded
0

How to use the XML to JSON

Three steps, all in your browser.

  1. 1

    Paste your input

    Type or paste your code or data. Press Sample to try an example.

  2. 2

    Check the options

    Adjust the options if you need to. The conversion updates instantly.

  3. 3

    Copy the result

    Copy the output in one click. Nothing is saved or sent anywhere.

XML to JSON: what to know

XML to JSON parses XML with fast-xml-parser and outputs formatted JSON, so you can work with feeds, SOAP responses or config files in JavaScript and other JSON-first tools. Elements become keys, text becomes values and repeated sibling elements become arrays.

XML has things JSON doesn't, so a few conventions apply. Attributes are kept as keys with an @_ prefix, so <price currency="EUR">9</price> keeps both the attribute and the text. An element that appears once becomes a single value while one that repeats becomes an array; code that reads the JSON should be ready for both shapes.

Malformed XML is reported with the problem rather than converted partly. Comments and processing instructions aren't part of the data and are left out.

Popular uses

  • Reading RSS and Atom feeds in JavaScript
  • Converting SOAP responses for a JSON API
  • Migrating XML config to JSON
  • Exploring the structure of an unfamiliar XML document

Tips for the best result

  • Numeric-looking text such as 007 stays as written when it matters; check IDs before relying on types.
  • If you always need an array for a repeated element, normalize it in your code: single items aren't wrapped.
  • Format the XML first with the XML formatter if you need to see its structure.

Read how JustYourDev works and our privacy details. Code, data and files you use here are processed in your browser and are never sent to our server.

Frequently asked questions