public function convertJsonStringToArray(ControllerEvent $event): void {
$request = $event->getRequest();
$requestContent = $request->getContent();
// check if json and not empty content
$isContentEmpty = true === empty($requestContent) || null === $requestContent || '' === trim($requestContent);
if (true === $isContentEmpty || $request->getContentType() !== 'json') {
return;
}
// check for errors
$jsonContent = \json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new BadRequestHttpException(sprintf('Invalid json body: %s', json_last_error_msg()));
}