JSON-Utils

XML to JSON

Convert XML documents and feeds into JSON. Attributes become keys prefixed with @_, element text becomes #text when an element also has attributes or children, and every value stays a string, exactly as XML stores it. These conventions are flagged before you convert, not buried.

XML
JSON
Result will appear here
Ready. Press Convert or Ctrl+Enter.

How to use the XML to JSON

  1. Paste XML into the input pane.
  2. Press Convert.
  3. Review the warnings, then copy the JSON.

Example

The id attribute becomes @_id on the book object.

<catalog><book id="1"><title>JSON Basics</title></book></catalog>

Frequently asked questions

Why are numbers still strings?

XML has only text. Coercing values would guess at your data, so numbers and booleans stay strings and you decide.

What about mixed content?

Elements mixing text and child elements put the text under #text. Deeply mixed content is a poor fit for JSON and may lose ordering.