isJson() && !empty($request->getContent())) { json_decode($request->getContent(), true); if (json_last_error() !== JSON_ERROR_NONE) { throw new BadRequestHttpException(sprintf('The JSON data passed in the request appears to be malformed. err_code: %d err_message: "%s"', json_last_error(), json_last_error_msg())); } } return $next($request); } }