HCODX/XML to JSON
100% browser-based · UTF-8 safe · No upload

XML to JSON

Convert XML documents into JSON. Nested elements become objects, repeated child tags become arrays, and leaf text content becomes string values. Uses the browser's native DOMParser — no upload, no server.

XML input
JSON output
Conversion options
Reverse (JSON → XML)
Input size
0 B
Output size
0 B
Output lines
0
Status
Ready
Example

XML in, JSON out

A small sample to show the shape of the conversion. Pretty-printed output, types preserved where possible.

XML
<root>
  <name>Alice</name>
</root>
JSON
{
  "root": {
    "name": "Alice"
  }
}
Use cases

What you'll use this for

XML to JSON shows up in every backend and ETL stack — feeding APIs, migrating configs, debugging payloads.

API & data imports

Prepare payloads for REST APIs and ingestion endpoints.

Data migration

Move configuration and tabular data between systems and formats.

Debugging

Inspect production data in a sensible, structured form.

ETL pipelines

Stage transformations between formats in your data flow.

Step by step

How to convert XML to JSON

1

Paste your XML

Drop your source into the left editor. The sample loads on first visit — replace it with your data.

2

Click Convert

Or leave Auto-convert on for live updates as you type. Conversion runs locally.

3

Review the output

The right pane shows pretty-printed JSON with status, byte counts, and line count.

4

Copy or download

Use the action bar to copy to clipboard or save as a file. Or jump to the reverse converter for round-trip checks.

FAQ

Frequently asked questions

If a parent has multiple children with the same tag name, they collapse into a JSON array. Single children stay as objects.

Not in this simple mode — only element content. For a richer mapping consider x2js or similar.

Plain leaf elements (no children) return their text content as a string. Mixed-content nodes return only their child elements.

Invalid XML triggers an error via DOMParser's <parsererror> element — the error is shown in the output pane.

Yes. All parsing happens in your browser; nothing is uploaded.

About

About XML to JSON

XML predates JSON and is still everywhere — SOAP, RSS, SVG, Maven POMs, Office documents. JSON is what modern APIs want. This converter does the basic element-tree mapping using the browser's native DOMParser.

How parsing works

  • DOMParser builds an in-memory tree from the input.
  • Each element becomes a JSON property; child elements become nested values.
  • Repeated sibling tags collapse into arrays.
  • Leaf elements return their text content.

Use cases

  • Inspect XML payloads from legacy SOAP services.
  • Pipe RSS/Atom feeds into a JSON-aware tool.
  • Translate Maven pom.xml structure for quick reading.
Related

Related tools