There is my function :
private function responseJson($datas, $code)
{
$serializer = $this->container->get('jms_serializer');
$context = new SerializationContext();
$context->setSerializeNull(true);
$response = new Response($serializer->serialize($datas, 'json', $context->enableMaxDepthChecks()), $code);
$response->headers->set('Content-Type', 'application/json');
return $response;
}
I use serializer components of symfony. This is what my server do when I call this function. The client need an array but the server returns an object. Is it possible to force to return an array ?
Thanks for your answers !