>>
PERMARKET
Tools › Developer › XML to JSON
X2J

XML to JSON

Convert an XML document into JSON.

Ad · Large Rectangle (336×280)

How to use XML to JSON

Free XML to JSON converter: map a well-formed XML document to JSON using the browser DOM parser, with no upload.

  1. Open XML to JSON on toolpermarket and enter your values in the fields below.

  2. Provide the value or text the tool asks for in the single input field. The field is labelled clearly so you always know what to enter.

  3. Press Convert to compute the result. The output appears immediately below the form. You can change any input and run it again to compare results.

  4. Read the result and use it as needed. If the number looks off, re-check your inputs and run it again — the math is deterministic, so the same entries always return the same answer.

Worked example. Converting <note><to>Ada</to><body>Hi</body></note> yields an object with to and body keys.

Tips for accurate results.

  • Well-formed XML is required; a stray tag stops the conversion.

  • Repeated tags become an array automatically.

  • Pure text content collapses to a simple string.

When to use XML to JSON. Feeding an XML feed into a JSON-based app. Comparing two data shapes during a migration. Turning a config file into something easier to read.

When you actually reach for this

  • You consume an XML or RSS feed and want to work with it as JSON in your code.
  • You are migrating a legacy XML config into a JSON-based system.

Where this tool stops being accurate

  • XML attributes and text content both become JSON fields, and the mapping convention (e.g. @attr vs $text) varies by tool.
  • Mixed content (text plus child elements) rarely maps cleanly and may need manual post-processing.

Frequently asked questions

What if my XML is invalid?

The tool reports that it is not well-formed so you can fix the broken tag before converting; it does not guess.

How are repeated elements handled?

When the same tag appears more than once, the value becomes a list, which mirrors how most JSON parsers expect repeats.

Is my XML uploaded?

No. Parsing uses the browser built-in XML parser and the text never leaves your device.

Where did my XML attributes go in the JSON?

Converters prefix attributes (commonly with @) and put element text under a key like #text or $. Check the output structure to address them.

Why is my single item an object but multiple items an array?

That is the classic XML-to-JSON ambiguity: a repeated element becomes an array only when there is more than one. Normalize on your side if consumers expect a list.