change error response to return json
change route errors to return json