Is it possible to get object from `twig` array knowing that the index is a `javascript` variable 

Mycontroller

```
public function showContactModalAction($iduser, $profil) {
    $em = $this->getDoctrine()->getEntityManager();
    $contacts = $em->getRepository("LeymaxContactBundle:User")->findBy(array('accesslevel' => 'arch'));

    return $this->render('LeymaxContactBundle:Default:contactModal.html.twig', array('contacts' => $contacts));
}

```

MyTwig

```
 $(".fils_zone_livre").on('click', function() {
        var index=3;
        var contacts = '{{contacts[index]}}';

    });

```

and I tried also:

```
var contactArray = '{{contacts|json_encode}}';

```

but i get this reponse:

```
[{},{},{},{},{},{}]

```

as an empty array