TEXT & DEVELOPER / FREE BROWSER TOOL

XML to JSON

Convert XML elements and attributes into JSON without numeric coercion.

Files are processed in this browser and are not uploaded to YYY Tools.Details
Opening workspace

About XML to JSON

Use the XML to JSON converter for a data-oriented XML document. You can convert XML attributes to JSON with an @_ prefix while preserving numeric-looking element text as strings. Repeated element names become arrays in the parser's mapping.

How to convert XML elements into JSON

  1. Paste XML with exactly one root element and no DOCTYPE declaration.
  2. Select Process to validate and parse the XML.
  3. Review the mapped values and download converted.json.

A practical example

Input
<root><name>Ada</name></root>
Result
{
  "root": {
    "name": "Ada"
  }
}

An id="01" attribute would appear as "@_id": "01"; numeric-looking text is not coerced.

Supported input and limitations

  • Input is limited to 1 MB, 100,000 elements/values, and 80 nesting levels. DOCTYPE/entity declarations and reserved __proto__ element names are rejected; external resources are not fetched.
  • This data mapping does not preserve mixed-content ordering, comments, processing instructions, or XML signatures. It is not XSD validation or a lossless XML archive.

Processing happens on your device. Read about local processing and optional workspace recovery.

Frequently asked questions

How are XML attributes represented in JSON?

Attributes use names prefixed by @_, such as @_id. Text alongside attributes or child elements can use #text.

Will XML numbers lose leading zeros?

Element text and attribute values remain strings, so 0012 is not deliberately converted to the number 12.

Related tools