🔀

XML to JSON Converter

Convert XML data to JSON format and vice versa. Handles attributes, nested elements, arrays, and CDATA sections.

Advertisement

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.

Embed this tool on your website

Use whole pixel dimensions from 1 to 4096.

× px (1–4096)

                        

💡 Integration Tip

Copy the embed code and paste it into your website HTML. The responsive version adapts to all screen sizes automatically.

2.3
3 ratings
✓

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

Map XML attributes, repeated elements and text to JSON, or reverse this mapping.
<r><n>1</n><n>2</n></r> → {"n":[1,2]}

How to use

1

Choose the mode and enter a draft; inspect the result before copying or downloading.

2

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.

Popular Tools

No more tools to show
Explore All Tools
FreeWebTools AI