DEVELOPER · AmpCub developer helper
XML ↔ JSON converter
Move quickly between XML and JSON structures.
Convert XML and JSON locally with a compact, explicit mapping. Attributes use @name, text uses #text, and repeated child elements become arrays.
Local only · DTD / ENTITY rejectedConvert XML and JSON
Compact mapping and safety limits
- XML attributes become keys such as @id; text becomes #text; repeated child element names become arrays.
- Namespace prefixes and xmlns declarations are retained as names / attributes when present.
- DOCTYPE and ENTITY declarations are rejected before DOMParser runs. External entity resolution is never offered.
- Mixed content can be represented, but compact JSON cannot guarantee the original interleaving order when converting back to XML.
- XML comments and processing instructions are not included in JSON output.
Frequently asked questions
Why are there whitespace-only #text values?
Indentation is text in XML. Minify the XML first or ignore those values.
Will the round trip be identical?
The structure matches, but mixed-content order, comments and indentation are not guaranteed.