title: Angular 2 CLI Project read json data from file
body: <p>I'm trying to read a json file from within my Angular2 src/app folder</p>
  
  <p>The directory structure is as follows:-</p>
  
  <p><a href="https://i.stack.imgur.com/9HVrx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9HVrx.jpg" alt="enter image description here"></a></p>
  
  <p>And I'm trying to read the file in app.config.js using the following code:-</p>
  
  <pre><code>public load() {
      return new Promise((resolve, reject) =&gt; {
          this._http.get("config.json")
              .map(res =&gt; res.json())
              .subscribe((data) =&gt; {
                  this.cache['config.json'] = new ConfigData(data.json());
                  resolve(true);
              });
      });
  }
  </code></pre>
  
  <p>But everything I try results in the following error:-</p>
  
  <p>zone.js:2224 GET <a href="http://localhost:4200/config.json" rel="nofollow noreferrer">http://localhost:4200/config.json</a> 404 (Not Found)</p>
  
  <p>Where do I need to put the file?</p>
  
  <p>I've tried moving it to the src directory to no avail. I've also tried:-</p>
  
  <p>app/config.json
  ./app/config.json</p>
  
  <p>I also added an assets folder under app and added it into there but that didn't work either</p>
  
  <p>What do I need to do?</p>
  
  <p>Thanks</p>