converting response to json if the request type should be in json