title: How can I open a JSON file in JavaScript without jQuery?
body: <p>I am writing some code in JavaScript. In this code i want to read a json file. This file will be loaded from an URL.</p>
  
  <p>How can I get the contains of this JSON file in an object in JavaScript?</p>
  
  <p>This is for example my JSON file located at <code>../json/main.json</code>:</p>
  
  <pre><code>{"mainStore":[{vehicle:'1',description:'nothing to say'},{vehicle:'2',description:'nothing to say'},{vehicle:'3',description:'nothing to say'}]}
  </code></pre>
  
  <p>and i want to use it in my <code>table.js</code> file like this:</p>
  
  <pre><code>for (var i in mainStore)
  {       
      document.write('&lt;tr class="columnHeaders"&gt;');
      document.write('&lt;td &gt;'+ mainStore[i]['vehicle'] + '&lt;/td&gt;');
      document.write('&lt;td &gt;'+ mainStore[i]['description'] + '&lt;/td&gt;');
      document.write('&lt;/tr&gt;');
  } 
  </code></pre>