XML-to-JSON template for returning datasource as JSON

I had a colleague who asked me about some code I wrote a few years ago, so I uploaded it to GitHub and thought I’d share it here as well: https://github.com/it-vegard/xml-to-json

Basically, it is an XSLT for Enonic CMS (tested in 4.7.x) that takes a datasource, (optionally) filters it and returns the result as JSON.

I have used this (in various forms) to create endpoints from which I could get data as JSON.
If I remember correctly, I created it as a named template “lib” once as well, so I might make a version for that once I have the time.

6 Likes