XML
XML and JSON Converter
Translate a simple XML tree to JSON, or build XML from a JSON object with one root key.
How this tool works
Attributes map to @attributes, text to #text, and repeated child elements to arrays. These rules make common API fixture shapes predictable.
Mixed-content ordering, namespace equivalence, comments, and processing instructions are not losslessly represented. Review conversions before replacing source data.
Examples
- Convert repeated item elements.
- Inspect attributes separately from child nodes.
- Create a synthetic XML fixture from JSON.
Common use cases
Worked synthetic example
Valid example
<order id="7"><item>A</item><item>B</item></order>
Expected: Attributes under @attributes and repeated item values in an array. The JSON shape follows the converter's explicit mapping.
Failure or warning to recognize
Warning / interpretation
Mixed text and child elements whose original order matters.
Expected: Mixed text and child elements can produce JSON that loses original text order; review the result before round-tripping.