National Nutrition Month Special: 18% Off sitewide
🔒 No upload — 100% in your browser

XML to JSON Converter

Convert XML to JSON for free in your browser. Paste XML, get a clean JSON object with attributes, CDATA and repeated elements handled correctly. No upload, no. It runs entirely in your browser — no signup, no installation, and nothing you paste or drop leaves your device.

Paste your XML on the left to see the JSON here.

How to Convert XML to JSON

This XML to JSON converter turns any XML document into a clean, readable JSON object you can use in APIs, scripts or data pipelines. Paste your XML on the left — or open an .xml file directly from your computer — and element attributes become JSON keys, repeated elements are collected into arrays, and CDATA sections, entity references and self-closing tags are all handled correctly. Text-only elements become plain strings, empty elements become empty strings, and the root element's attributes and children become the top-level JSON keys. You can switch between 2 and 4 space indentation and optionally convert numeric and boolean text values to real JSON types so your data arrives ready to use. Everything runs in your browser: your data is never uploaded, and you can copy the JSON or download it as a .json file.

  1. Paste your XML on the left — or click Open .xml file to load a document from your computer. Load sample fills the editor with a realistic catalog example you can convert right away.
  2. The conversion runs automatically while you type or paste; the Convert button does the same on demand. Malformed input shows a clear inline error instead of broken output.
  3. Choose 2 or 4 spaces for the JSON indentation — the output re-renders immediately when you switch.
  4. Optional: enable Convert numbers & booleans so true, false, 249.90 or 1e5 become real JSON booleans and numbers instead of strings. Values with leading zeros or a bare decimal point stay strings.
  5. The JSON appears on the right, with a status line showing the root element and the output size in characters. Copy it to the clipboard or download it as converted.json.

Standards-aware conversion: text and attribute values are decoded following the XML 1.0 rules for entity and character references, while CDATA content stays 100% literal. Comments, processing instructions and whitespace-only text are removed during parsing, and the result is emitted with JSON.stringify, so the output is always valid JSON (RFC 8259). See the XML 1.0 specification and RFC 8259 for the underlying standards.

Frequently Asked Questions

Is my XML uploaded to a server?

No. The whole conversion runs in your browser: the XML is tokenized and parsed locally with JavaScript, and .xml files are read with the FileReader API. Nothing is transmitted, there is no account and no backend is involved.

How are attributes and repeated elements converted?

Attributes become JSON keys with an @ prefix (@id, @currency), so they can never collide with child element keys. Repeated sibling elements, for example several product tags, are collected into an array. Keys appear in document order.

Does it handle CDATA, entities and namespaces?

Yes. The standard XML entities and numeric character references are decoded in text and in attribute values. CDATA sections stay fully literal and are never decoded. Namespace prefixes such as ns:item or xmlns are preserved as plain names; the tool does not resolve namespaces.

What does the numbers and booleans option do?

When enabled, the text true or false becomes a real JSON boolean and numeric-looking text such as 249.90, 14 or 1e5 becomes a real number. Values with leading zeros (007) or a bare decimal point (.5) stay strings so no data is corrupted. Attribute values are converted the same way.

What happens to comments, whitespace and processing instructions?

Comments and processing instructions such as the XML declaration are removed, and whitespace-only text between elements is ignored, so the JSON contains only your data. The input must contain exactly one root element; its attributes and children become the top-level JSON keys, and the root name is shown in the status line.

More free tools

What is XML to JSON Converter?

XML to JSON Converter is a free online developer tool built for developers debugging payloads, configs and code. Convert XML to JSON for free in your browser. Paste XML, get a clean JSON object with attributes, CDATA and repeated elements handled correctly. No upload, no In practice you paste your XML, run the conversion so attributes, CDATA and repeated elements are handled, and then copy the JSON object.

Your code, tokens and payloads never leave the browser, which matters when you are debugging something under NDA or handling production data.

How to use XML to JSON Converter

  1. Paste your XML.
  2. Run the conversion so attributes, CDATA and repeated elements are handled.
  3. Copy the JSON object.

XML to JSON Converter FAQ

Is XML to JSON Converter free to use?

Yes. XML to JSON Converter is completely free and needs no account, no trial and no payment details. Every feature on the page is available without limits.

Is my data uploaded anywhere?

No. XML to JSON Converter runs entirely in your browser, so the text, file or number you enter never leaves your device.

Does XML to JSON Converter work on a phone or tablet?

Yes. It works in any modern browser on desktop, tablet and phone. There is no app to install and no account to create.

How do I use XML to JSON Converter?

Paste your XML. Run the conversion so attributes, CDATA and repeated elements are handled. Copy the JSON object.

Related tools