Return json when json is requested

422 (unprocessable_entity) seems like a more appropriate HTTP response code for unparsable json. Also, for a json api, it seems preferable if the response is json instead of an HTML error page.
:-1: for doing special treatment here. We should do it in the exception wrapper.