Write the json content type for API responses

Closes #604
I will do the generalization with another issue - that's coming from some other prototyping I was doing and mixed my commits.