XML ⇄ JSON Converter

Actions & options

XML attributes map to @-prefixed keys; repeated sibling elements become arrays.

What is XML ⇄ JSON Converter?

XML→JSON follows the common convention: attributes become @-prefixed keys, element text becomes #text when mixed with children, and repeated sibling elements collapse into arrays — exactly the shape most JSON APIs and jq pipelines expect. DOMParser does the parsing, so error messages are precise.

JSON→XML walks your object back into indented elements with a root name you choose; @-prefixed keys round-trip as attributes, arrays expand to repeated elements. Great for eyeballing SOAP bodies, sitemaps, RSS feeds or legacy API payloads.

Frequently asked questions

What do the @ prefixes mean?

XML attributes have no direct JSON equivalent, so id="7" becomes "@id": "7" — a convention (used by xml2js and others) that also round-trips back to a true attribute.

How are repeated elements handled?

Two sibling <item> elements become "item": [...] — an array — which is how JSON APIs represent lists; single children stay as plain values.

Does it fetch URLs or files?

No — paste the text. Fetching remote XML would hit CORS in most cases, so the tool stays purely local.