Skip to content
Created by Iternal Technologies, the AI Strategy ExpertsBy Iternal (opens in a new tab)

Convert

XML to JSON

XML

Paste one XML element and its JSON object appears as you type.

JSON

About XML to JSON

XML to JSON reads one element and writes a JSON object whose only key is that element name. Each attribute becomes a key prefixed with @. An element that contains only text becomes a JSON string. Text on an element that also has attributes or children is stored as #text. Sibling elements that share a name become one array, in the order they appear.

A leading XML declaration is accepted and is not copied into the JSON. Comments are dropped. A document type declaration is rejected, and custom entities are not expanded: only the five built-in entities and numeric character references are read. Whitespace between tags is ignored and text is trimmed, so indentation does not become extra values.

Indent output is on by default and uses two spaces. Turn it off for a single line of JSON. Swap moves the result to JSON to XML so you can check a round trip. The conversion runs in the page and does not send the document anywhere.

Frequently asked questions

What XML does this accept?

One element, with an optional XML declaration before it. Comments may appear and are dropped. Nested elements, attributes, CDATA sections and the five built-in entities are read. A DTD, a processing instruction, a second root or a broken tag is reported at that spot.

How are attributes and text written?

An attribute becomes a key that starts with @, so an id attribute is the key @id and its value is a string. Direct text becomes #text when the element also has attributes or children. An element whose only content is text becomes a JSON string instead. Repeated sibling names become an array.

Are numbers kept as numbers?

No. XML attributes and text are strings, so a digit stays a string. When you convert JSON back to XML, numbers and booleans are written as their decimal or literal text.

Is the text I paste uploaded anywhere?

No. Conversion runs in your browser and the text you paste is never uploaded, logged or stored. Google Analytics records page views and feature use, never content.

  • JSON to XML

    Turn JSON into an XML element. A one-key object is the root, arrays repeat tags, and text is escaped. It runs in your browser and your text is never uploaded.

  • Markdown to HTML

    Convert Markdown to clean HTML with a live preview. GitHub tables, task lists and footnotes included.

  • Markdown to DOCX

    Convert Markdown to a Word document (.docx) with a page preview. Tables, lists, footnotes and heading styles included.

  • JSON ↔ YAML

    Convert JSON to block YAML, or a YAML subset back to JSON.

  • CSV to JSON

    Convert a CSV table into a JSON array.

Iternal · AI Blueprint Builder

Plan the AI initiative, not just the output

The AI Blueprint Builder scores each use case across value, feasibility, cost, governance, risk, adoption and readiness before you commit budget. Free to start, about 60 minutes.

Open the AI Blueprint Builder (opens in a new tab)