Skip to content

XML to JSON

Convert XML to JSON keeping attributes and namespaces. Handles SOAP envelopes and large files.

Install XML to JSON

  1. 1Tap the Share button — in Safari's toolbar or its ⋯ menu.
  2. 2Scroll down and tap Add to Home Screen.
  3. 3Tap Add. XML to JSON then opens from your Home Screen like an app and keeps working offline after your first visit.
  1. 1 Paste XML
  2. 2 Convert
  3. 3 Copy or save

Step 1 of 3: Paste XML or a SOAP envelope.

XML Input

JSON Output

All Developer Tools

XML to JSON Converter — Attributes, Namespaces & SOAP

Convert XML documents to JSON format with our free browser-based converter. The tool handles XML attributes (converted to @attribute keys), nested elements, CDATA sections, and namespaces.

Paste XML data and get a clean JSON representation ready for use in modern APIs and applications. Runs entirely inside the browser.

XML carries structure that JSON has no direct equivalent for, so the mapping is stated up front: attributes become keys prefixed with @, text content of a mixed element goes into #text, repeated sibling elements collapse into an array, and CDATA sections are unwrapped to their contents. Namespaces are kept on the key rather than thrown away, so a document using two schemas does not silently lose the distinction. The result is ordinary JSON you can feed straight into JavaScript, a JSON column in Postgres, or any modern API client.

How to use XML to JSON

  1. Paste your XML markup into the input field.
  2. Adjust configuration, like attribute prefix modifiers.
  3. Click Convert to generate the equivalent JSON object.
  4. Click the button to copy it safely to your clipboard.

Features

  • Handle XML attributes, nested elements, CDATA — Full XML support.
  • XML syntax validation with error messages — Spots invalid XML automatically.
  • Pretty-print JSON output — Clean, readable output format.
  • Support for large XML documents — Handles complex structures.
  • Configurable attribute prefix (@, _, $) — Customize attribute notation.
  • 100% client-side processing — Safe to use for personal datasets.

Frequently Asked Questions

How are XML attributes represented in JSON?

Because JSON does not natively support "attributes" separate from key-value pairs, our tool prepends specific characters (like @) to attribute names so they don't collide with child elements.

Does it support exceptionally large XML files?

Yes, because there are no upload payload limits. However, generating enormous JSON trees might momentarily freeze older browsers or consume more temporary memory.

Can I decode SOAP XML envelopes?

Absolutely. SOAP APIs return standard XML, which the tool will smoothly translate into nested JSON parameters spanning headers and the underlying response body payload.

Why does a single child element become an object but two become an array?

Because XML has no way to say "this is a list of one". A converter can only see what is there. If your downstream code needs an array every time, normalise after conversion — check whether the value is an array and wrap it if not. This is the classic gotcha when an XML feed happens to return one item that day.

Are namespaces preserved?

Yes. Prefixed element and attribute names keep their prefix in the JSON key rather than being flattened away. That matters for documents that combine schemas, such as a sitemap with image or video extensions, where two different elements can otherwise collapse onto the same key.

Search tools

  • Merge PDFPDF Tools
  • Sign PDFPDF Tools
  • Compress PDFPDF Tools
  • PDF to WordPDF Tools
  • PDF to TextPDF Tools
  • PDF to ImagePDF Tools
  • Image CompressorImage Tools
  • Background RemoverImage Tools
  • Image to Text (OCR)Image Tools
  • HEIC to JPG ConverterImage Tools