Fix bug with generating json for lists of resources