Get data from json request with Symfony

When working with Symfony actions you can get request parameters with $request->get('parameter-name'). When working with JSON requests, you don't have this kind of convenience methods. You're going to need to convert the request into parameters first. This could be done the following way:

public function transformAction(Request $request)
    $parametersAsArray = [];
    if ($content = $request->getContent()) {
        $parametersAsArray = json_decode($content, true);