XML to JSON
Convert XML to clean, pretty-printed JSON in your browser - with control over attributes and value types. Nothing is uploaded.
Attributes become keys prefixed with @_, so id="7" maps to
@_id.
Turn XML into usable JSON
Plenty of legacy APIs, RSS feeds and configuration files still speak XML, but most modern code would rather work with JSON. Paste your XML above and it is converted the moment you stop typing, using a proper XML parser rather than a fragile regular expression. The result is pretty-printed JSON you can copy straight into your editor or download as a file.
Attributes and the @_ prefix
XML draws a line between an element attribute and a child element, but JSON does not. To keep
the two apart, attributes are converted to keys prefixed with @_. So
<user id="7"> gives you "@_id" alongside any child elements,
and nothing collides. If you only care about the element content, untick
Preserve attributes and those keys disappear entirely.
Types and validation
By default, values that look like numbers or booleans are converted to real JSON numbers and booleans, in both text and attributes. Switch Parse numbers and booleans off when you need everything to stay a string - useful for identifiers with leading zeros. Before any conversion happens the document is validated, so malformed XML gives you a line-numbered error instead of broken output.
Need the other direction or a tidy-up? Use the JSON to YAML converter, pretty-print with the JSON formatter, or reshape tabular data with JSON to CSV.