All tools

XML ↔ JSON

Data

Convert XML to JSON and JSON back to XML with attribute handling

Paste an XML API response and get back equivalent JSON, with attributes distinguishable from element content via a configurable prefix like `@_` and text content captured under a `#text` key, or run it in reverse to turn a JSON object back into XML for a legacy SOAP integration. XML namespace prefixes are preserved as-is in the output, but the tool doesn't resolve them to their actual namespace URIs, so anything relying on true namespace-aware processing needs a dedicated XML library instead. Because XML and JSON aren't a perfect structural match (repeated elements, mixed content, attribute ordering), round-tripping XML to JSON and back isn't guaranteed to reproduce byte-identical output, even though the data itself is preserved. Conversion happens entirely in your browser.

xmljsonconvertparsetransform

How to use XML ↔ JSON

  • 1.Paste an XML API response to convert it to JSON so you can more easily consume it in JavaScript or inspect nested structures.
  • 2.Convert a JSON object back to XML when integrating with a legacy SOAP service or system that only accepts XML payloads.
  • 3.Toggle attribute handling to control whether XML attributes become `@_` prefixed keys or get merged into the element's JSON object.

Frequently asked questions

How are XML attributes represented in the JSON output?
Attributes are typically prefixed (e.g. `@_id`) to distinguish them from child elements and text content, since JSON has no native concept of attributes.
Does round-tripping XML → JSON → XML always produce identical output?
Not always exactly — things like attribute ordering, self-closing tags, and whitespace-only text nodes can differ after a round trip, even though the semantic content is preserved.
Is my data sent to a server for conversion?
No, conversion happens entirely in your browser.
Does this handle XML namespaces?
Basic namespace prefixes are preserved as part of element names, but full namespace-aware processing (resolving a prefix to its URI) isn't performed.

Use via API, SDK, or MCP

Installnpm install @utilix-tech/sdk
Usageimport { data } from '@utilix-tech/sdk'
const result = data.xmlToJson('<user><name>Alice</name><age>30</age></user>')
console.log(result) // { user: { name: 'Alice', age: '30' } }

Runs locally · no API key · no rate limits · Node.js SDK docs →