Work on retuning JSON

Work on making an abstract function to handle returning JSON arrays in a
safe manner.