Data Processing · JSON & XML

XML to JSON — process data locally.

Paste XML to turn its elements, attributes and text into JSON, or decode the typed XML produced by JSON to XML.

Private data workspaceProcesses locally · up to 2 million characters per input
Ready

Note: Generic XML maps attributes to @name, element text to #text, and repeated elements to arrays. Typed <data> XML restores original JSON values. DTD and custom entity declarations are rejected for safety. Mixed content order and XML namespaces are not preserved.

How to use this tool

Process data in your browser

Paste your data or select a local UTF-8 file. Adjust the settings if available, then choose Convert XML to JSON. Copy the result or download the generated file. The input stays in your browser.

Supported behavior and limitations

Generic XML maps attributes to @name, element text to #text, and repeated elements to arrays. Typed <data> XML restores original JSON values. DTD and custom entity declarations are rejected for safety. Mixed content order and XML namespaces are not preserved.

Input is limited to 2 million characters per editor. If your file is larger, use a dedicated desktop data tool. This utility does not execute SQL or scripts embedded in your input.

Practical walkthrough

Understand repeated XML elements

You want to inspect an XML catalog in a JSON-based workflow and preserve multiple child elements as multiple values.

XML sample

<catalog><book id="a">First</book><book id="b">Second</book></catalog>

Expected behavior

The generic XML mapping groups the two book elements into an array and represents the id attributes separately from the element text.

Check before using the output

Generic XML-to-JSON mapping does not preserve mixed-content order or XML namespaces. The special typed XML produced by this website’s JSON to XML tool has its own round-trip mapping.

Next step: Generate typed XML from JSON.