MergeJSON

XML to JSON Converter.

Convert XML to clean JSON in one click — with attribute handling, repeated-tags-to-arrays, and namespace support. 100% private: your data never leaves the browser.

No signup · No uploads · No file-size cap

JSON output

// Paste input and press “Convert to JSON”.

Convert XML to JSON online — free and private

An XML to JSON converter turns XML markup into structured JSON that modern APIs and JavaScript can use directly. Paste your XML above, press Convert to JSON, and the parser maps elements, attributes, and text into clean JSON. Unlike server-based tools, this one parses everything in your browser, so you can convert XML to JSON online without uploading sensitive files.

How to convert XML to JSON in three steps

  1. Paste your XML into the input, or click “Load sample”.
  2. Choose your options — type inference, force arrays, and whether to keep or ignore attributes.
  3. Convert and export — copy the JSON or download it as data.json.

Attributes, arrays, and namespaces handled properly

XML has features JSON does not, so handling them well matters. Attributes are preserved under an @ prefix, mixed text goes under #text, and repeated elements are collected into arrays automatically — with a force-array option for predictable output. Namespace prefixes are kept, CDATA is read as text, and type inference converts numbers and booleans.

Why use this XML to JSON tool?

It is fully client-side with no upload and no size cap — a real advantage over tools that send your XML to a server. Need the reverse? Use the JSON to XML converter, or try YAML to JSON and CSV to JSON. Learn more in our guide on how to convert XML to JSON.

FAQ

XML to JSON, answered.

How do I convert XML to JSON online?+

Paste your XML into the converter above and press Convert to JSON. The tool parses the markup, maps elements to keys, and shows formatted JSON instantly. You can copy it or download a .json file. Everything runs in your browser, so nothing is uploaded.

How are attributes handled?+

Element attributes become keys prefixed with @ by default, so <book id="1"> becomes { "book": { "@id": 1 } }. Mixed content keeps the text under a #text key. You can also choose to ignore attributes entirely if you only need the element data.

What about repeated elements and arrays?+

Repeated child elements with the same tag are automatically collected into an array. If you need single elements to be arrays too (for predictable parsing), enable Force arrays so every child becomes a list.

Does it handle namespaces and CDATA?+

Yes. Namespace prefixes are preserved in key names (for example x:note stays x:note), CDATA sections are read as text, and comments and the XML declaration are ignored. Numeric and boolean text can be auto-converted with type inference.

Is it private, and is there a size limit?+

It is 100% client-side — unlike server-based converters that upload your file, your XML never leaves the browser. There is no file-size cap because everything is processed locally.