XML ↔ JSON Converter

Convert XML to JSON or JSON to XML in your browser. Configure attribute mapping and CDATA handling, inspect the output, then copy or download it.

Mapping and limits

Local XML/JSON mapping, up to 1 MB of UTF-8 input. Root and attributes are kept; repeated children use arrays, mixed order uses #content and CDATA can use #cdata. Formatting, comments, processing instructions and JSON scalar types are not preserved. DTD and XSD validation are unsupported.

Input

Advanced settings

Output

XML ↔ JSON Converter

Convert structured XML data into JSON for inspection, or produce XML from JSON that follows this tool’s mapping. The XML root is retained. Repeated child elements become arrays; attributes use an @ prefix by default or an @attributes object. Mixed text and child-element order is represented with #content.


For example, two item children under root become an item array inside the root object. CDATA can be read as text or retained as #cdata. This is a data mapping, not a byte-for-byte round trip: formatting, comments, processing instructions and JSON scalar types are not preserved. Input is limited to 1,000,000 UTF-8 bytes, 20,000 mapped nodes and 64 levels. DTD/entity declarations are rejected; XSD validation is not provided.

Features

  • Convert in either direction or detect the direction automatically.
  • Map attributes with a chosen prefix or an @attributes object.
  • Represent repeated children as arrays and ordered mixed content with #content.
  • Choose CDATA handling, indentation, line endings and optional UTF-8 BOM before downloading.

How to use

  1. Select XML to JSON, JSON to XML or Auto, then paste the source. Use the built-in example to see the expected mapping.
  2. Choose attribute handling and whether CDATA should become text. Keep those settings consistent when converting back.
  3. Convert and inspect the root, repeated elements and mixed content; correct reported input errors.
  4. Copy or download the output. If an application requires an XSD schema, validate against it separately.