XML to JSON Converter
Convert XML data to JSON format and vice versa. Handles attributes, nested elements, arrays, and CDATA sections.
Map XML attributes, repeated elements and text to JSON, or reverse this mapping.
DTD/entities are refused before DOMParser. Mixed text order, comments and whitespace are not lossless; text is trimmed and combined. Null/empty containers are ambiguous. Text cap: 1,000,000 characters; 64 levels and 50,000 entries.
Method and limits
Method and limits
The outer XML root is omitted. Attributes use @name, repeated children become arrays and text uses #text when needed. Reverse mode uses the selected document root.
Decimal JSON uses JavaScript numbers; precision-changing tokens and unsafe integers are rejected. Quote exact identifiers.
Decimal JSON uses JavaScript numbers; precision-changing tokens and unsafe integers are rejected. Quote exact identifiers.
Processing happens in this browser; these converters do not upload your draft. Other site features can make requests.
Working…
Options
Copied
Copy failed. Select the result and copy it manually.
About XML to JSON Converter
Map XML attributes, repeated elements and text to JSON, or reverse this mapping. The outer XML root is omitted. Attributes use @name, repeated children become arrays and text uses #text when needed. Reverse mode uses the selected document root.
<r><n>1</n><n>2</n></r> → {"n":[1,2]}
DTD/entities are refused before DOMParser. Mixed text order, comments and whitespace are not lossless; text is trimmed and combined. Null/empty containers are ambiguous. Text cap: 1,000,000 characters; 64 levels and 50,000 entries.
Use Cases
How to use
Choose the mode and enter a draft; inspect the result before copying or downloading.
The outer XML root is omitted. Attributes use @name, repeated children become arrays and text uses #text when needed. Reverse mode uses the selected document root.
Pro Tips
- DTD/entities are refused before DOMParser. Mixed text order, comments and whitespace are not lossless; text is trimmed and combined. Null/empty containers are ambiguous. Text cap: 1,000,000 characters; 64 levels and 50,000 entries.
Frequently Asked Questions
The outer XML root is omitted. Attributes use @name, repeated children become arrays and text uses #text when needed. Reverse mode uses the selected document root.
DTD/entities are refused before DOMParser. Mixed text order, comments and whitespace are not lossless; text is trimmed and combined. Null/empty containers are ambiguous. Text cap: 1,000,000 characters; 64 levels and 50,000 entries.