title: Save a json in a javascript array
body: <p>I'm trying to save a json in a javascript array but I don't understand how to do it. I don't want to save all the content in the first element of the array.
  That's my function:</p>
  
  <pre><code>function jeyson()
  {
  var onion = new XMLHttpRequest();
  onion.open("GET", "json.json", true);
  onion.send(null);
  
  /* var anotheronion = angular.fromJson(onion.responseText, false); */
  
      var onionarray = new Array()
  
  }
  </code></pre>
  
  <p>onionarray is the array that I'd like to contain my json file.</p>
  
  <p>My json could be something like:</p>
  
  <pre><code>{
  
  "count": 2,
  "e": 1,
  "k": null,
  "privateresult": 0,
  "q": "surname",
  "start": 0,
  "cards": [
      {
          "__guid__": "efd192abc3063737b05a09a311df0ea0",
          "company": false,
          "__title__": "name1 surname",
          "__class__": "entity",
          "services": false,
          "__own__": false,
          "vanity_urls": [
              "name1"
          ]
      },
      {
          "__guid__": "01917cfa71a23df0a67a4a122835aba8",
          "photo": {
              "__own__": false,
              "__title__": null,
              "__class__": "image",
              "__guid__": "01917cfa71a23df04d03f83cb08c11e1"
          },
          "company": false,
          "__title__": "name2 surname",
          "__class__": "entity",
          "services": false,
          "__own__": false,
          "vanity_urls": [
              "name2"
          ]
      }
  ]
  
  }
  </code></pre>
  
  <p>How can I save it in my array?</p>
  
  <p>PS I don't have problems like "same origin policy" because the json file is on the same server (for now I'm working with local files. Could I work with files that are not on the same domain?).</p>
  
  <p><strong>PS</strong>
  Is it possible to use json as a javascript object (like an array)? If I want to search something in my json object how can I do it?</p>
  
  <pre><code>function geisson()
  {
  var iabile = new XMLHttpRequest();
  iabile.open("GET", "json.json", true);
  iabile.send(null);
  
  var objectjson = {};
  objectson = JSON.parse(iabile.responseText);
  alert(objectson.cards.toSource());  
  return false;
  }
  </code></pre>