Remade the json formatting fixes to use the json encoder

Not sure why I didn't use this earlier, but there is a python json
library that properly handles the encoding/decoding of json data. Remade
the earlier fixes to use this library. Also added some other misc fixes
Added an api to retrieve json formatted issue lists

Added an api to perform different queries for issues. reponse is a json
formatted object that can be displayed using the datatables javascript
utility.