Refactor data set json endpoints

Refactored serialization code into it's own lib and moved views into their own directory.