XML & JSON Converter
Map structured XML to a readable JSON object or build XML from a compatible object. Review the mapping rules before using the result as an interchange format.
Browser-based · No account required · Copy and export
XML ⇄ JSON Converter Workspace
Developer tools · EmeraldQuick object mapping groups same-name children and can lose interleaved order and namespace identity.
Inspect structure, nodes and validation
Selected node
Convert a document, then choose a node.
Node locations are logical paths, not reliable source character offsets.
Batch convert multiple local XML / JSON files
No batch files selected. Each file is independently transformed.
| File | Input | Status | Output | Action |
|---|
ZIP contains converted output files and a metadata-only manifest (without raw source excerpts). This is not an XML schema/XSD validator.
Mapping settings & editable project exports
Profiles store settings only. Project backups include source text only when you explicitly tick the box.
How to use XML & JSON Converter
- Choose the conversion direction and paste data or load a local text file.
- Set indentation, whitespace handling and a fallback XML root. Enable mixed-content rejection if order loss would be unacceptable.
- Convert and inspect the result. Copy or save the output using the direction-appropriate extension.
When to use this tool
Move simple XML records into a JSON workflow or rebuild XML from the supported JSON representation. Attributes, repeated elements and mixed content need careful comparison after conversion.
XML and JSON have different data models
Attributes map to @name keys, text maps to #text when an object has other fields, and repeated sibling names become arrays. XML text stays text rather than guessing numbers or booleans. Mixed content can interleave words and elements; this object mapping groups values and cannot preserve that original order.
Worked example
<item id="7"><tag>a</tag><tag>b</tag></item>
becomes {"item":{"@id":"7","tag":["a","b"]}} Inspect attributes and repeated tags before using the mapping
Original XML practice input
<item sku="0012"><tag>draft</tag><tag>review</tag></item>
For this example, inspect the JSON for an item object, a text-valued @sku attribute and a tag array containing draft and review. Numeric-looking XML content is not automatically typed as a JSON number.
- Choose XML to JSON and paste the authored input. Keep strict mixed-content rejection enabled when preserving interleaved words and elements matters.
- Compare attribute names and repeated-element counts with the source. A single tag and repeated tags can produce different value shapes, so inspect more than one representative record.
- If returning to XML, check the chosen root and valid element/attribute names. Rebuilt markup need not reproduce source whitespace or presentation.
- Keep the original when mixed text, comments, namespace-sensitive processing or byte-for-byte fidelity matters. Disabling a rejection does not make the object mapping preserve mixed-content order.
Authored mapping exercise, not a supplied converted artifact. DOCTYPE input remains rejected. For expected JSON shape checks, use JSON Schema Validator; for text-level source review, use Text Diff.
Limits and output checks
Quick object mapping is lossy: comments, processing instructions, namespaces and mixed-content order cannot be reconstructed reliably. Ordered structure mapping preserves supported parsed node order and namespace names but not original XML bytes. DOCTYPE/DTD input is rejected and unsafe JSON integers are rejected.
Reference: XML document parsing.
Frequently asked questions
Are XML numbers converted to JSON numbers?
No. Element and attribute text remains strings.
What does mixed-content rejection do?
For XML input it rejects elements containing both child elements and meaningful text, avoiding silent acceptance of an order-losing mapping.
Will namespaces round-trip?
Not through Quick mapping. Select Ordered structure to retain parsed namespace URIs and element/text order (not original lexical bytes).
Mapping profiles, namespaces and safe serialization
Quick object mapping places XML attributes in @attribute, combined text in #text and repeated child names in arrays. It does not retain interleaved element order or namespace identity. Strict mode rejects elements containing child elements and meaningful text rather than treating their conversion as reversible.
Ordered structure records parsed element names (prefix/local name/namespace URI), attributes, ordered text/CDATA, comments and processing instructions. Round-trip verification compares those parsed nodes, not original source bytes, XML declarations, entity spellings or original quotation marks.
DOCTYPE/DTD input, remote entity resolution and automatic schema fetching are disabled. The XML serializer produces compact markup to avoid inserting new text. XML and JSON syntax checks are not XSD or JSON Schema validation.
Files and conversion data stay in your browser. No input document is stored persistently unless you explicitly export a project containing it. Batch downloads contain transformed output documents and a metadata-only manifest.
Specifications: W3C XML, XML Namespaces and JSON RFC 8259.
A practical object mapping, not XML preservation
Choose the conversion direction and inspect how attributes, repeated elements and text appear in the result. Use a representative element before converting a larger document.
Scope of this workflow
The simplified mapping does not preserve namespace semantics or mixed-content order. XML text stays strings rather than becoming inferred numbers.
JSON Schema Validator - Draft-07 Instance Checks · All developer tools · Privacy policy · Contact PixelOkay