AscendLab

Developer tools

XML 转 JSON

Free browser tool

XML to JSON Converter

Convert XML elements, attributes, and text into readable JSON locally for data cleanup, examples, and QA notes.

XML input
Paste XML and convert elements, attributes, and text into JSON.
JSON output
XML converted to a JSON object.
Quick answer

XML to JSON conversion turns XML nodes into nested JSON objects.

Attributes use an @ prefix and repeated elements become arrays.

Best inputs

Use well-formed XML

Close tags and fix parser errors before relying on output.

Review arrays

Repeated elements are grouped, which may differ from your target schema.

XML conversion method
The browser parses XML and walks the element tree.
Element names become object keys.
Attributes are represented with @ prefixes.
Text content appears as strings or #text fields when mixed with child elements.
Example, Assumption, and Limitation
Use the result as a practical estimate or transformation, then confirm edge cases for critical work.

Example

<item id="1">A</item> becomes item with @id and text value.

Assumption

The XML is intended for data inspection or simple conversion.

Limitation

Namespaces, schemas, CDATA, and mixed content may need manual review.

Common use cases
These pages are built for lightweight browser-side work, examples, and planning.

API examples

Convert XML payloads into JSON examples.

Debugging

Inspect nested XML quickly.

Docs

Show JSON equivalents.

Migration

Start simple XML cleanup work.

Frequently asked questions

Does this upload XML?

No. XML parsing and JSON conversion run locally in the browser.

How are XML attributes represented?

Attributes are included with an @ prefix, such as @id.

How is repeated XML handled?

Repeated child elements with the same tag are grouped into arrays.

Is this a full XML schema converter?

No. It is a practical XML-to-JSON conversion helper for common data inspection.

Suggested workflow

XML cleanup workflow

Format XML, convert to JSON, then inspect or extract JSON values.