Private data converter

XML to JSON Converter

Convert XML data into clean JSON format. Upload, paste, or load XML from a public URL, preview the result, adjust advanced options when needed, and download JSON.

Processed locally Pretty JSON Advanced XML options
Converter

Convert XML to JSON

No upload

XML input

JSON output

Preview

Paste XML or upload a file to preview the JSON structure.

Elements stay nested Repeated nodes become arrays XPath can target nodes

Loads public XML directly in your browser. The source must allow CORS.

Leave empty to convert the whole XML document. Optional XPath works in Standard mode.

Private by design

Your XML file never leaves this tab

Your XML is parsed, converted, and previewed locally in your browser.

Processed locally

Your XML file is read and converted right here in this browser tab.

No account required

No sign-up, email, payment details or tracking pixels are needed.

Tree data flattened locally

API responses, SOAP XML, configuration files, and XML documents stay on your device until you download the JSON.

No upload: your file is converted in this tab. We do not receive your file name or file content.
Three steps

How to Convert XML to JSON

1

Paste or upload XML

Paste XML data, choose an .xml file, or load a public XML URL that allows browser requests.

2

Choose JSON options

Choose how attributes, namespaces, special text blocks, and larger files should be handled.

3

Download JSON

Review the JSON preview, then download a clean .json file for APIs, apps, or data migration.

Example

XML to JSON Example

XML input

<employee>
  <id>1</id>
  <name>Alice</name>
  <role>Developer</role>
</employee>

JSON output

{
  "employee": {
    "id": "1",
    "name": "Alice",
    "role": "Developer"
  }
}
Attributes

Convert XML Attributes to JSON

XML attributes often carry IDs, types, currency codes, and metadata. The default mapping keeps them visible with an @ prefix. If you need those attributes in spreadsheet columns instead, use the XML to CSV or XML to Excel converter.

XML with attributes

<product id="123">
  <name>Keyboard</name>
</product>

JSON with @ attributes

{
  "product": {
    "@id": "123",
    "name": "Keyboard"
  }
}
Namespaces

XML Namespace Handling

SOAP XML and API responses often use namespace prefixes. This converter removes namespaces by default for cleaner JSON keys, with an option to preserve them.

SOAP XML

<soap:Envelope>
  <soap:Body>
    <GetUserResponse>
      <name>Alice</name>
    </GetUserResponse>
  </soap:Body>
</soap:Envelope>

JSON without prefixes

{
  "Envelope": {
    "Body": {
      "GetUserResponse": {
        "name": "Alice"
      }
    }
  }
}
Advanced conversion

Advanced XML Conversion Options

Convert specific nodes

Convert the whole document or target only the records you need, such as //item, /catalog/book, or a SOAP body response.

XML URL input

Load public XML directly from your browser when the source allows CORS, then convert it without a server upload.

CDATA options

Merge CDATA into text, preserve it as #cdata, or ignore it depending on how your JSON consumer expects content.

Large-file mode

Use local large-file mode for XML up to 25 MB when you do not need to select specific nodes. For very large files, conversion speed depends on your device and browser.

Format basics

XML vs JSON

XML

  • Tree-shaped data with elements and attributes
  • Common in SOAP APIs, feeds, and configuration files
  • Can include namespaces and CDATA sections

JSON

  • Tree-shaped data with objects and arrays
  • Common in REST APIs, apps, and JavaScript workflows
  • Easy to inspect, copy, and pass into modern tools
Good to know

Frequently Asked Questions

How do I convert XML to JSON?

Paste XML data or upload an .xml file, choose how attributes and namespaces should be handled, preview the JSON output, then download the converted JSON file.

Can I convert XML to JSON online?

Yes. This XML to JSON converter runs in your browser, so you can convert XML online without creating an account or installing software.

How are XML attributes converted to JSON?

By default, attributes are added with an @ prefix, such as @id. You can also merge attributes into the object or ignore them.

Can I convert SOAP XML responses to JSON?

Yes. SOAP XML can be converted to JSON. Namespaces are removed by default for cleaner keys, and you can preserve namespaces when you need the original prefixes.

Does the converter support nested XML?

Yes. Nested XML stays nested in JSON, and repeated elements with the same name become JSON arrays.

Can I convert an XML string to JSON?

Yes. Paste an XML string into the input box and convert it directly to JSON.

Can I convert only part of an XML document?

Yes. Use the specific nodes field to target paths such as //item or /catalog/book. When multiple nodes match, the converter returns them as a JSON array.

Can I load XML from a URL?

Yes, if the XML URL is public and allows browser requests. The URL is fetched directly by your browser, not through our server.

How does CDATA convert to JSON?

CDATA is merged into text by default. You can also keep CDATA in a #cdata field or ignore CDATA content.

Is my XML file uploaded to a server?

No. Your XML file stays in your browser and is not uploaded to our servers.

More converters

Related Data Converters

Ready to turn XML into JSON?

Paste XML or choose a file and convert it locally in your browser.

Go to converter