Small ToolsAll tools
← All tools / Data Formats
Data Formats utility

XML to JSON

Convert XML elements and attributes into a JSON structure.

● This tool runs entirely in your browser. Your input is never uploaded to our servers.
Output
Your result will appear here…

How to use XML to JSON

  1. Paste a well-formed XML document.
  2. Select Convert to map elements and attributes to JSON.
  3. Copy the formatted JSON output.

Example

Input:

<person id="7"><name>Ada</name><active>true</active></person>

Output:

{
  "person": {
    "@attributes": {
      "id": "7"
    },
    "name": "Ada",
    "active": "true"
  }
}

Use cases

About this tool

Convert XML elements and attributes into a JSON structure. Processing happens locally in your browser, so your input is not sent to a server or included in analytics.

Frequently asked questions

How are attributes represented?

Attributes are grouped under an @attributes object.

How are repeated elements represented?

Repeated sibling elements with the same name are collected into arrays.

Are XML values converted to numbers or booleans?

Element text is kept as strings to preserve the source value.

Related tools