title: Accessing multiple JSON files in JavaScript
body: <p>I have some sprite sheets with the atlus saved in a JSON format. I'm structuring my atlus based upon the <a href="https://github.com/mozilla/BrowserQuest/tree/master/client/sprites">structure from BrowserQuest</a>. Each of their JSON files looks like:</p>
  
  <blockquote>
  <pre><code>{
      "id": "agent",
      "width": 24,
      "height": 24,
      "animations": {
          "idle_down": {
              "length": 2,
              "row": 0
          }
      },
      "offset_x": -4,
      "offset_y": -8
  }
  </code></pre>
  </blockquote>
  
  <p>But I'm wondering, how do I even access the data in each JSON file, if it just a raw object literal?</p>
  
  <p>Since each JSON file is an object literal, the only way I could imagine accessing it is to save the object literal to a variable, such as</p>
  
  <pre><code>var agent = {
      "id": "agent",
      "width": 24,
      "height": 24,
      "animations": {
          "idle_down": {
              "length": 2,
              "row": 0
          }
      },
      "offset_x": -4,
      "offset_y": -8
  };
  </code></pre>
  
  <p>I'm hoping there is an easy way to access JSON files.</p>
  
  <p>And because each individual sprite sheet has its own JSON file, I have a large number of files to load.</p>
  
  <p>What is the best way to load such a high number of JSON files?  I'm trying to avoid using any JS libraries.</p>