XML ↔ JSON Converter

Attributes
1 line · 0 B

XML ↔ JSON Converter

Convert between XML and JSON, with control over how XML attributes map into the JSON representation.

1 line · 0 B
UTF-8 · XML → JSON · prefixed

About this XML ↔ JSON Converter

Convert between XML and JSON, with control over how XML attributes map into the JSON representation.

Conversion runs locally in your browser. Nothing is uploaded or stored. Attribute handling controls whether XML attributes appear as @_prefixed keys, merge into plain keys alongside child elements, or are dropped entirely.

FAQ

How are XML attributes represented in the JSON output?

Depends on the Attribute mode: Prefixed puts them under an @_ prefix (id="1" becomes "@_id": "1"), Merged drops the prefix so attributes sit as plain keys alongside child elements, and Ignored discards them entirely.

What happens when the same tag appears more than once?

Repeated sibling tags become a JSON array — the only lossless way to represent repetition in JSON. A tag that appears once stays a single object, so handle both cases (check if it's an array before iterating).

Are XML comments preserved in the JSON output?

No — JSON has no comment syntax, so XML comments are discarded.

How does it handle CDATA sections?

CDATA content is unwrapped into plain text, indistinguishable from a regular text node in the JSON output — the CDATA markers themselves aren't preserved.

Does this work both directions (JSON to XML too)?

Yes — switch between XML → JSON and JSON → XML with the toggle above the input.

Is my data uploaded to a server?

No — parsing and conversion run 100% client-side.

Related tools