Write the json content type for API responses

Closes #604