I want to get data which I get from a controller action and parsed as json in typeahead.
Whenever I try to get the data, I get a error in the javascript console of my browser.

```none
Uncaught TypeError: Cannot use 'in' operator to search for '15014' in [{"id":19,"title":"Getting Started","slug":"getting-started"...

```

Every time I change something in the text box the number changes.

When I go to the url Bloodhound uses directly and give it a query, the response with the correct json formatted data is returned.

**searchAction**

```
/**
 * Gets the articles based on a query which is passed from search.js
 *
 * @Route("/search/{query}", name="opifer.manual.help.search", options={"expose"=true})
 * @Method({"POST", "GET"})
 *
 * @param \Symfony\Component\HttpFoundation\Request $request
 *
 * @return \Symfony\Component\HttpFoundation\Response
 */
public function searchAction($query, Request $request)
{
    $searchQuery = $query;
    $artRepo = $this->getDoctrine()->getRepository('OpiferManualBundle:Article');
    $serializer = $this->container->get('jms_serializer');

    // Set search result to be the serialized database entities it the search box is not empty
    if ($searchQuery != "")
    {
        $searchResult = $artRepo->getSearchedArticles($searchQuery);
        $searchResult = $serializer->serialize($searchResult, 'json'); // Serialized the entity
        $response = $searchResult;
        $responseCode = 200;
    }

    $response = json_encode($response); //json encode the array
    return new Response($response, $responseCode, ['Content-Type' => 'application/json']);
}

```

**search.js**

```
/**
 * Created by tomschillemans.
 */
$(document).ready(function() {
    console.log("The Document has been loaded!");

    var remoteUrl = Routing.generate('opifer.manual.help.search', { query: 'WILDCARD' });
    var prefetchUrl = Routing.generate('opifer.manual.help.search_all');
    var articles = new Bloodhound(
    {
        datumTokenizer: function(d)
        {
            return Bloodhound.tokenizers.whitespace(d.val);
        },
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        remote:
        {
            url: remoteUrl,
            wildcard: 'WILDCARD'
        },
        //prefetch: prefetchUrl
    });

    articles.initialize();

    $('#searchfieldId').typeahead(null, {
        name: 'search',
        displayKey: 'title',
        source: articles.ttAdapter(),
        templates:
        {
            empty:
            [
                '<div class="empty-message">',
                    '<p>Unable to find any articles that match the current query</p>',
                '</div>'
            ].join('\n'),
            suggestion: Hogan.compile(
                '<a href="{%url%}">{%title%}</a>',
                {delimiters: '{% %}'}
            )
        },
        engine: Hogan
    });
});

```

**articles.json**

```
{
  "articles":
  [
    {"title": "Getting Started", "slug": "getting-started"},
    {"title": "Markdown Examples", "slug": "markdown-examples"},
    {"title": "Some other article", "slug": "some-other-article"}
  ]
}

```