What this tool does
The converter processes recursively starting from XML document elements. Leaf nodes with only plain text and no attributes will be simplified to strings; elements with attributes or child nodes are represented by objects to avoid attributes and text covering each other.
- Attributes are placed uniformly in the @attributes object.
- Text that needs to be saved separately uses #text.
- Repeated elements with the same name under the same parent node are merged into Array.
How to use it
- Paste a valid XML document containing the root element.
- Click "Convert to JSON".
- Check @attributes, #text and array structures.
- Copy the results or download result.json.
Common uses
- Convert XML interface responses into a structure that is tractable for the front end.
- Observe the array representation of repeated elements in JSON.
- Migrate old configuration files containing properties.
XML → JSON Features
Convert XML nodes, attributes, text and repeating elements to JSON according to fixed rules. It is suitable for daily development, debugging, data sorting and code optimization scenarios. The processing results can be directly viewed, copied or downloaded.
FAQ
Why are attributes not placed at the same level as child elements?
@attributes clearly distinguish XML attributes from child elements of the same name, reducing key conflicts and making rules predictable.
How to deal with repeated elements?
When an element with the same name appears for the second time under the same parent node, the key will be converted into an array, and subsequent values will be added in sequence.
Will comments go into JSON?
Comments and processing instructions are ignored by default because they are generally not business data; attributes, elements, and salient text are retained.