Helper method to get installed packages as json array