Free XSLT 1.0 stylesheet to transform XML data to JSON

While looking for an XSLT 1.0 stylesheet, which is able to transform XML to JSON, I had to realize that none of the existing stylesheets generate valid JSON code.
Most of them have problems if a node has sub-nodes and attributes at the same time, others don't handle arrays correctly. But both are essential requirements for me, so I've decided to write my own XML to JSON transformation stylesheet.

Features & Limitations


This work is licensed under the MIT license.

That means, you may:

You may not:

You must:


Filename Release Date Size
xml2json.xsl 2019-10-16 3.52 KiB 2019-10-16 1.83 KiB


This output is formatted to give you an overview about the object layout. The code which is returned by the stylesheet doesn't contain spaces and line-feeds to get the object code as small as possible.

Move the mouse cursor above a key name, to get more details about it.

Test your own XML file (max. 256 KiB):


If you have questions, improvement ideas, bug reports or anything else, feel free to contact me at