handle if the request is json