XML to JSON

Convert XML, an RSS feed or an SVG into JSON, with attributes kept as @name and repeated siblings collected into arrays.

xml
JSONjson
The result appears here

Questions

How are attributes represented?+

As keys prefixed with @, beside the element's children. XML has two kinds of content and JSON has one, so the prefix is what keeps an attribute from colliding with a child of the same name.

When does an element become an array?+

When it appears more than once under the same parent. A single item stays an object, which is the ambiguity every XML conversion has to live with: one entry and two entries come out differently shaped.

Are values typed?+

Numbers and true/false are converted, everything else stays a string, and an empty element becomes null. XML itself has no types, so this is a convenience rather than a rule.

Related tools

The tools are free. So is most of the library.

1935 blocks and 989 pieces for shadcn/ui and Tailwind, built on the same tokens these tools write. Install one with a command and the code is yours.

No signup for the tools. MIT for free blocks, commercial licence for Pro.

Markdown version