Serialize POST request body into array with FOSRestBundle
<p>I am trying to make a Rest web service using Symfony 3 and FOSRestBundle.<br>
I come from a Spring + Jackson background so i'm trying to make it so that you can pass objects to controllers as request body that become function parameters and return objects that get serialized into json, so far i managed to make it work for everything except for arrays.<br>
This is my code:</p>

<p>configuration:</p>

<pre><code>#FOSRestBundle
fos_rest:
    param_fetcher_listener: true
    body_listener: 
        enabled: true
        decoders:
            json: fos_rest.decoder.json
    format_listener:
        rules:
            - { path: ^/, priorities: [ json ], fallback_format: json, prefer_extension: true }

    body_converter:
        enabled: true
        #validate: true

    view:
        mime_types:
            json: ['application/json', 'application/json;version=1.0', 'application/json;version=1.1']
        view_response_listener: 'force'
        formats:
            xml:  false
            json: true
        templating_formats:
            html: true

    exception:
        codes:
            'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
            'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
        messages:
            'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
    allowed_methods_listener: true
    access_denied_listener:
        json: true
</code></pre>

<p>This is the controller</p>

<pre><code>&lt;?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use JMS\DiExtraBundle\Annotation\Inject;
use FOS\RestBundle\Controller\Annotations\Post;
use FOS\RestBundle\Controller\Annotations\View;
use FOS\RestBundle\Controller\FOSRestController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

class DefaultController extends FOSRestController {

    /**
     * @Post("/rest", name="rest_test")
     * @ParamConverter("myArr", converter="fos_rest.request_body")
     * @View
     * @param Request $request
     */
    public function restAction(Request $request, array $myArr) {
        return $myArr;
    }
}
</code></pre>

<p>When i try to call this from my rest client (putting <code>[1, 2]</code> as request body) i receive this error:</p>

<pre><code>{
  "code": 500,
  "message": "Converter 'fos_rest.request_body' does not support conversion of parameter 'myArr'."
}
</code></pre>

<p>If i turn <code>myArr</code> into an object (that is i change its type from <code>array</code> to <code>MyObject</code>, containing the <code>number</code> variable <code>myVar</code>) and send data that reflects that object structure (such as <code>{"myVar": 2}</code> ) it works fine, but it doesn't work with an array. </p>