Neatbo.

XML to JSON tree

Convert XML with mixed text and elements to an order-preserving JSON tree.

Browser-local processingInputXMLOutputJSONUp to 10 MiB per file · File limit: 1
  1. 1Add input
  2. 2Review and run
  3. 3Get your result

Tool input and files are processed in this browser without being uploaded.

Your input

Inputs are kept temporarily in this tab when switching tools. Refreshing or closing clears them; large results may need to be regenerated.

⌘ / Ctrl + Enter to run
XML source
0 characters · 0 bytes

Check XML before conversion

The JSON tree preserves mixed text, element order, attributes and in-root comments. It does not infer a domain object schema.

Paste XML or select a file to begin

Preparing the tool…

Before you start

Convert XML with mixed text and elements to an order-preserving JSON tree. Inspect name, attrs and children instead of losing text order in a grouped object mapping.

How to use this tool

  1. Paste XML or select a UTF-8 .xml or .txt file.
  2. Check the root and counts, then convert to the ordered JSON tree.
  3. Inspect mixed children and attributes; copy or download the complete JSON.

Supported inputs and limits

XML 1.0 and UTF-8 only. DTD declarations and external entities are rejected. Pasted text is limited to 1 MiB; a file to 10 MiB; the tree to 200,000 elements and 128 levels.

Children retain source order. Adjacent text and CDATA are combined; comments and processing instructions inside the root are retained, while those outside it are omitted.

This is a structural tree, not a domain-specific schema. Files are processed in this browser.

Worked example

Example input

<user id="7">Mori</user>
Example options
{}

Example output

{
  "name": "user",
  "attrs": {
    "id": "7"
  },
  "children": [
    "Mori"
  ]
}

When something does not work

Correct malformed XML, use UTF-8 and XML 1.0, or remove DTD declarations. Check the target importer’s expected JSON shape.

Frequently asked questions

Will text stay in the right place between elements?

Yes. The children array follows XML source order, including text, elements, in-root comments and processing instructions. Adjacent text and CDATA become one text node.

Does it preserve namespaces and external entities?

Element namespace URIs and qualified names are retained. DTD declarations and external entities are rejected; this tool does not resolve external resources.

Is this JSON accepted by my importer?

The output uses a name/attrs/children tree. Check whether your importer expects that shape; it is not a generic business-object mapping.

Documentation & further reading

Related tools