XML to JSON Converter

Paste XML to get JSON. Attributes, repeated elements and text are handled, and nothing is fetched from outside.

Use the tool

Loading the tool…

About XML to JSON Converter

Convert XML into JSON. For attributes, you can keep them with an @ or _ in front of the name, or leave them out.

Worked example

Paste `<person id="7"><name>Asha</name></person>`. Keeping attributes with @ gives a JSON field called @id, next to name.

Limits

XML and JSON do not map one-to-one. Repeated elements, mixed text and attributes can convert in ways you did not expect, so check the output against your data before using it.

How to use XML to JSON Converter

  1. Paste the XML.
  2. Choose how to treat attributes.
  3. Copy the JSON.

Good to know

  • Repeated elements become a list and empty elements become null.
  • Values stay as text, because XML has no numbers.
  • Custom entities and a DOCTYPE with declarations are refused.
  • The input can be up to 1 MB.

Frequently asked questions

Are numbers converted?

No. XML has no types, so values stay as text.

Why is my DOCTYPE refused?

A DOCTYPE with its own declarations could define entities. Entities are never expanded here, which avoids entity attacks.