Get started
HomeText & ContentXML to JSON
Text & ContentRuns in your browser · files never uploaded

XML to JSON

Convert XML documents

4.7· 51 votes
Your file never leaves this browser. Everything runs on your device — no uploads, no server storage, no retention.How it works →
XML241 chars
JSON0 chars

What is XML to JSON?

Convert an XML document to JSON, preserving attributes as "@name" keys when you want them. Two common use-cases: reading a legacy API that returns XML but you want to work in JSON, and exploring XML structure without squinting at tag pairs. The parser validates XML first, so you get a clear error if the source is malformed.

How do I use XML to JSON?

  1. Paste XML into the input panel.
  2. Toggle "Keep attributes" depending on whether you want them in the output.
  3. Copy or download the JSON.

When should I use XML to JSON?

XML to JSON keeps the tree structure. For flat tabular output (rows and columns), use XML to CSV. To convert in the other direction, JSON doesn't map cleanly to XML in general — use a dedicated tool for that round-trip.

Frequently asked
How are attributes represented in the JSON?

With an "@" prefix by default — <a href="x">text</a> becomes {"a": {"@href": "x", "#text": "text"}}. Toggle "Merge attributes" for a flatter shape.

What if an element repeats?

Repeated siblings become an array automatically — the tool detects this by scanning the document. Single elements stay as objects.

Is the conversion lossless?

Close to, but not exactly. Mixed content (text interleaved with elements) is hard to round-trip cleanly. For complex XML, keep the original.

Is my file uploaded anywhere?

No. Everything runs in your browser. Your files never leave your device, and there is no server component for this tool.

Related in Text & Content
Text Compare
JSON Beautifier
JSON Minifier
XML Formatter
YAML Formatter
Case Converter
Word Counter
Character Counter