Report

Help us improve this tool

XML Attributes to JSON

Turn XML into JSON using an @attributes and #text convention so element attributes stay explicit.

O M T

XML to JSON with an explicit attribute convention

Standard XML-to-JSON mappers often prefix attributes with @_. Attribute mode keeps structure readable for APIs and config tools by moving each XML attribute into a dedicated @attributes object on the element, while text nodes use #text when mixed content is present.

Example shape

An element <book category="fiction">Gatsby</book> becomes JSON where book contains @attributes.category and a string or #text field for element content. Arrays and nested elements recurse with the same rules.

Conversion uses fast-xml-parser in the browser. Related tools: JSON to XML Attributes, XML Attributes to Elements, and XML Validator.

Frequently Asked Questions

How is this different from the default XML to JSON tool?

The default converter keeps attributes as @_name keys on the same object. Attribute mode groups them under @attributes, which many REST and GraphQL adapters expect.

Are numbers and booleans typed?

Yes, when values look numeric or boolean, fast-xml-parser may coerce them. Treat output as data, not a strict schema, unless you validate separately.

Is the XML declaration included?

By default the ?xml processing instruction is omitted from the JSON root. You can disable that option in the UI.