Converters

XML ⇄ JSON Converter

Convert XML documents to JSON and back. The converter handles attributes (using @ prefixes), text content, CDATA sections, and nested elements. When converting XML to JSON, attributes become @-prefixed keys and element text becomes a #text key. The reverse conversion produces valid XML from JSON.

XML ⇄ JSON — Convert XML documents to JSON and back

What it does

  • Converts XML to JSON with attributes as @-prefixed keys
  • Handles CDATA sections, comments, and processing instructions
  • Converts JSON back to XML with proper element and attribute structure
  • Preserves namespace prefixes in element names
  • Handles mixed content (elements with both text and child elements)

Use cases

  • Converting SOAP API responses to JSON for modern application use
  • Transforming RSS/Atom feeds to JSON for processing
  • Migrating XML configuration files to JSON format
  • Debugging XML structure by viewing it as JSON

How it works

1

Paste your XML into the input pane

2

Choose XML → JSON or JSON → XML direction

3

The converted output appears instantly in the output pane

4

Copy the result for use in your application

Frequently asked questions

1How are XML attributes represented in JSON?

Attributes are prefixed with @ to distinguish them from child elements. For example, <item id="42">text</item> becomes {"item": {"@id": "42", "#text": "text"}}. This follows a common XML-to-JSON convention.

2Can it convert JSON back to XML?

Yes. The reverse conversion takes JSON with @-prefixed keys for attributes and #text for text content, and produces valid XML. This lets you round-trip data between the two formats.

3Does it handle XML namespaces?

Namespace prefixes are preserved in the JSON keys (e.g., ns:element becomes "ns:element" in JSON). The namespace declarations themselves are treated as attributes.

Related tools

Use XML ⇄ JSON offline in Devinity

All 95 tools run locally on your Mac. No internet required, no data sent to servers.

Download Devinity →