IT Market
Tools/Code/Documents/XML to JSON Converter Online
XML → JSON

Конвертируйте XML в JSON формат

Tool guide

XML to JSON Converter Online

The reverse errand: a supplier feed, a catalogue export or a SOAP response arrives as XML, but the work happens in JavaScript or a Python script. Paste the document into the XML Input box, press the convert button, and you get a structure where tag names have become keys and a run of identically named siblings has collapsed into an array. Parsing is done by the page itself, so a supplier's price list never leaves the machine. See also: run the conversion the other way, back to XML, indent an unreadable XML file first, export the parsed nodes to a table.

How to use it

  1. Paste the document into the XML Input box, with or without the declaration on the first line.
  2. Check that every tag is closed and there is a single root element; one unclosed tag makes the whole parse fail.
  3. Press Convert and the structure appears in the JSON Output box.
  4. Watch the repeated nodes: a run of identically named tags becomes an array, while a lone one does not.
  5. Press Copy JSON or Download JSON to take the result into your code or keep it as a file.

FAQ

Why are numbers and dates quoted strings?

Without an attached schema every XML value is text: 8900 says nothing about being numeric. The parse does not guess types and carries the content across as a string, which is the safe choice for SKUs with leading zeros and phone numbers. Cast the fields you need in code, where you know what each tag means.

What happens to attributes such as ?

The parsing here is lightweight and concentrates on node nesting and text content. Check your own document to see whether attributes survived into the output. If they carry meaningful data and the JSON lacks them, process the file with a full parser on the backend, or rewrite the attributes as child elements before converting.

How are namespaces and prefixes like soap:Body handled?

The colon stays part of the tag name, so you get a key spelled "soap:Body" in the JSON, reachable through bracket notation rather than dot notation. If the prefixes get in the way, strip them with find and replace before converting — safe when you are only reading a feed, not when a request signature depends on them.

Why did one product become an object and two become an array?

XML has no separate marker for a list, so a single-item list looks exactly like an ordinary child element. A feed with one item yields an object and a feed with two yields an array, which is why code that always expects an array breaks on the first short file. Check the node type as you walk it, or coerce it to an array.

Will a feed of several dozen megabytes load?

Your tab's memory sets the limit, not a server quota. Small documents parse instantly, while a multi-megabyte price list can freeze the page because the whole tree is built in memory. For big exports paste a fragment — a couple of product entries — to learn the structure, then process the full file with a script.

An error message appeared instead of the result. What now?

The document did not parse, and the page says so outright instead of handing back an empty box or half a structure. The message comes from the browser's own parser and usually names the line. The usual culprits are an unclosed tag, two root elements side by side, raw & or < characters inside text, or a file truncated when it was copied. Fix the spot it names and try again.

Examples

One item from a supplier feed
Before: A-1 Desk chair 8900
After: { "offer": { "id": "A-1", "name": "Desk chair", "price": "8900" } }
Repeated sibling nodes
Before: sale new
After: { "tags": { "tag": ["sale", "new"] } }