Skip to main content

XML to JSON

New

Convert XML documents to JSON format with attribute and namespace support.

xmljsonconvert
Read the guide
Shortcuts:⌘ KSearch

Frequently Asked Questions

How are XML attributes represented in the JSON output?

Attributes are added as keys prefixed with @, so <book id="1"> becomes {"@id":"1"} when Include attributes is enabled.

What happens if an element has both text and child elements?

The text content goes under #text and child elements become their own keys. That keeps mixed-content elements from losing either piece.

Do repeated sibling tags turn into arrays?

Yes. If the same child tag appears more than once under the same parent, the tool converts that key into an array and pushes each value into it.

Can I remove text nodes or attributes from the conversion?

Yes. There are separate toggles for Include attributes and Include text nodes, and changing them reruns the conversion on the current XML.

What does Compact output actually change?

Only the JSON formatting. Pretty mode uses 2-space indentation, while compact mode removes indentation by calling JSON.stringify with 0 spaces.

Related Tools