MyScripter
Tools

XML to JSON Converter

Working with an API that returns XML when you need JSON? Paste the XML here and get well-structured JSON output with sensible attribute handling, proper array detection, and configurable formatting. Everything runs locally in your browser.

XML to JSON Converter

How to Use This Tool

  1. Paste your XML content into the input editor.
  2. Configure attribute prefix and array handling options.
  3. Preview the generated JSON output.
  4. Copy or download the JSON result.

Features

  • Handles deeply nested XML structures
  • Configurable attribute-to-property mapping (@attr or $attr)
  • Automatic array detection for repeated elements
  • CDATA section handling
  • Formatted and minified output options

Example

Config snippet

Sample

<root><item id="1"/></root>

What you get

Indented JSON mirror for debugging parsers.

Frequently Asked Questions

How are XML attributes converted to JSON?
By default, attributes are prefixed with @ (e.g., @id). You can change this to $, _, or remove the prefix entirely. Child elements and text content are mapped to regular JSON properties.
Does this handle XML namespaces?
Yes. Namespace prefixes are preserved in property names by default (e.g., "soap:Body"). You can toggle namespace stripping if you prefer clean property names.

Related Tools