Developer Tools

XML / JSON Converter

Use an explicit JSON tree when XML order and mixed text matter. Repeated siblings, attributes, and inline elements stay distinct instead of being collapsed into ambiguous object keys.

Free online tool

Loading tool…

79 / 500,000 characters. Processing stays in this browser.

Preserve the XML tree

The JSON model uses a children array and typed element, text, cdata, comment, and pi nodes. Elements store name, ordered attributes (name/value), and children. All XML values stay strings, including IDs, booleans, and prices.

Round-trip rules and supported XML

Child order, namespace declarations, attributes, text, comments, CDATA, and processing instructions are represented. Entity spelling, quote style, empty-tag style, line-ending spelling, and PI separator spacing are normalized. XML 1.0 line-end and literal attribute-whitespace normalization apply. An initial BOM is removed. An optional declaration is stored as declaration.

ASCII names and declared namespace prefixes are supported. DTDs, custom entities, external resources, XML 1.1, and non-UTF-8 declarations are rejected. Generic business JSON is not automatically mapped into XML: use the explicit tree model shown in the example.

All parsing and exports run locally in your browser. Example records are original fictional data, not an external dataset.

GET STARTED

How to use the XML / JSON Converter

  1. 01

    Choose XML to ordered JSON tree or the reverse direction.

  2. 02

    Paste XML, or load the JSON tree example to see the required model.

  3. 03

    Convert and inspect the typed nodes. Use reverse with output to check the normalized round trip.

Examples

Mixed text keeps its position

<p>Hello <b>world</b>!</p> becomes text, element, and text nodes in that exact child order.

Numbers stay XML text

<id>9007199254740993</id> stores the ID as a string in the JSON tree. It does not infer a numeric application type.

The mapping is an ordered syntax tree

A document has children and may have a declaration string. Element nodes contain type, name, ordered attributes as name/value objects, and ordered children. Text, cdata, and comment nodes contain type and value. Processing instructions use type pi, target, and value. Every XML data value is a string. The JSON example is editable and can be converted back.

What survives a round trip

Element and child order, attribute values, namespace declarations, mixed text, comments, CDATA, and processing instructions are represented. Quote choice, entity spelling, empty-tag syntax, processing-instruction separator spacing, BOM, and original line-ending spelling are normalized. XML line-end and literal attribute-whitespace normalization apply. This is not a byte-identical archive format.

Validate before generating markup

Reverse conversion accepts only the documented tree shape and refuses unknown properties. Names, namespaces, character ranges, comments, root count, and nesting are checked. ASCII XML names are supported. DTDs, custom entities, XML 1.1, and non-UTF-8 declarations are refused; no external resource is read.

What to know

  • Input is limited to 500,000 characters. Review the supported syntax and export policy described above.

Common questions

Can I convert any business JSON into XML?

No. There is no single universal mapping from generic JSON keys to XML attributes and elements. Use this tool’s explicit ordered-tree model.

Why is the JSON verbose?

The model makes text positions, repeated siblings, attributes, and comments explicit. That allows a predictable reverse conversion.

Are namespace prefixes preserved?

Yes, names and namespace declaration attributes are stored explicitly. Undeclared prefixes and invalid namespace declarations are rejected.

Sources & references