Skip to content
ConvertPassConvertPass home

Developer

XML to JSON

Map XML into JSON while keeping attributes and text nodes visible.

This tool processes files and text locally in your browser. Your content is not uploaded or stored by this site.

0 B
Empty

Empty. Paste text, drop a file, or load the example.

What this tool does

fast-xml-parser reads the document without resolving external entities. Attributes become keys prefixed with @_. That mapping is conventional, not magical, and it is documented so you can reverse it.

How to use it

  1. Paste XML.
  2. Inspect attribute keys and #text nodes in the JSON.
  3. Use JSON to XML if you need to go back, with a single root key.

Supported input

  • XML text, UTF-8, up to 2 MB

Output

  • Pretty-printed JSON

Privacy

This tool processes files and text locally in your browser. Your content is not uploaded or stored by this site.

ConvertPass does not include your input in analytics, URLs, or error reports. Encoding: UTF-8. The XML declaration is not required, but if present it should match the actual bytes.. Limit: 2 MB (2.00 MB).

Limitations

  • DTDs and external entities are not resolved.
  • XML mixed content is awkward in JSON. The #text convention is lossy if you already use that name.
  • Namespaces are treated as part of the element name, not expanded.

Example

Input
<note importance="high"><to>Ada</to><body>Bring punch cards</body></note>
Output
{
  "note": {
    "@_importance": "high",
    "to": "Ada",
    "body": "Bring punch cards"
  }
}

Troubleshooting

Parse error at the first line
Look for unescaped ampersands. In XML, & must be written as &amp; unless it starts a well-formed entity.

FAQ

Is this a standard XML to JSON mapping?

There is no single standard. Badgerfish, Parker, and others disagree. ConvertPass documents its mapping and keeps it stable so you can write code against it.

Are XXE attacks possible here?

The parser does not fetch external entities. Still, do not treat converted JSON as HTML, and do not paste XML you would not open on your own machine.

What about SOAP envelopes?

They convert as nested objects. You will need to pick the payload node yourself. This tool does not special-case SOAP.

Why are numbers still strings?

XML has no number type. Promoting 01 to 1 would lose data, so values stay strings.

Related tools

  • JSON to XML

    Build XML from JSON when you already know the root element name.

  • JSON formatter

    Pretty-print JSON locally with clear parse errors and a one-click copy.

  • YAML to JSON

    Parse YAML into JSON without custom tags or server-side processing.

Related guides

Related formats

Last reviewed 16 August 2026. Report a problem. Reports do not include your input.