input
output
Convert JSON to XML, or paste XML to convert it back to JSON.

Related

Guides for JSON to XML

All guides →

Convert JSON to XML and XML to JSON

Paste JSON and click To XML, or paste XML and click To JSON. The converter maps attributes to @-prefixed keys, element text to #text, and repeated elements to arrays — and reverses all of it. Everything runs in your browser; no data is sent to any server.

The mapping rules

  • Attributes<note id="1"> becomes { "note": { "@id": "1" } }
  • Text nodes — an element with attributes and text stores the text under #text
  • Repeated elements — two <tag> siblings become a JSON array
  • Entities&amp;, &lt;, and numeric references are decoded/encoded both ways

For the details behind each direction, see XML to JSON Conversion and JSON to XML. If your JSON has syntax errors, the tool repairs common mistakes first — or clean it with JSON Fix.

Also an XML formatter and validator

When you paste XML and click To JSON, the converter parses the document first — so it works as an xml formatter, xml formatter online, xml formatter online tool, xml beautifier ( xml beautify), xml editor, xml parser, xml reader online, xml viewer online / online xml viewer, reader xml, xml file validator, and xml validator (xmlvalidate, xmllint online validator) in one step — a one-stop answer to what is a xml file and how to open or check one. Searches for format xml online, online xml formatter, xml pretty print, xml validation, validation of xml, or xml to json converterall land on the same workflow. Malformed XML (mismatched tags, missing quotes, stray characters) is reported in the status bar instead of being silently passed through. If you only want to format XML, click To JSON to validate, then To XML to round-trip back with consistent two-space xml indentation online.

How to open an XML file (also asked as how to open the xml file or how to open xml files in bulk): paste the contents here and click To JSON for a structured, indented view. The same flow works as a valid xml checker — the converter only succeeds when the input is well-formed XML. Searches in other languages — formatar xml online (Portuguese), formatador xml online — describe the same tool.

FAQ

How do I make a JSON value an XML attribute?

Prefix the key with @ (for example @id). Element text content goes under #text. JSON arrays become repeated elements with the same tag name, because XML represents lists as repetition.

Can I use this as a standalone XML viewer?

Yes — paste XML and convert it to JSON for a structured, indented view, or convert back to XML to see the document re-emitted with normalised whitespace. Both directions are local-only.