jquery compare arrays $.getJSON
<p>I am trying to compare 2 arrays. One is taken from DOM, generated by <strong>.split(" ")</strong>, the other I would like to be retrived by <strong>$.get</strong> call. </p>

<p>All is working fine if I test the <strong>dictionary</strong> array manually. Example: </p>

<pre><code>  // var dictionary = ["in", "the"]; // &lt;- this one works
  var dictionary = $.getJSON('job/dictionary/en');
  $(this).keyup(function() {
      var words = $(this)
                    .text()
                    .split(" "),
          words_final = [],
          i = 0;
        jQuery.grep(words, function(word) {
            if (jQuery.inArray(word, dictionary) == -1) words_final.push(word);
            i++;
        });
    });
</code></pre>

<p>Response from this URL is <em>Content-Type: application/json</em> with response body: </p>

<pre><code>[
   "in",
   "the"
]
</code></pre>

<p>Apparently... then I try to run <strong>$.getJSON('job/dictionary/en')</strong> in chrome dev tools, I get an object back with responseText: <em>"["in","the"]"</em> </p>

<p>I've tried with <strong>$.get()</strong> as well with the same result. </p>

<p>Any help really appreciated. </p>
