title: What is the best way to load a JSON file in typescript?
body: <p>I want to load a local JSON file for testing purposes in my angular2 app written in typescript. I have 1) Included the jQuery.d.ts file, and tried to use $.getJson() 2) tried $.ajax() with async:false. The problem with both of these is that I cannot call functions outside of the callback function. </p>
  
  <pre><code>ngOnInit():any {
      $(document).ready(function(){
          $.ajax({
              async: false,
              url: "../jsonfile/guestRecommendations/1.json",
              dataType: "json",
              method: "GET",
              success: function (data) {
                  this.hello();
              }
          });
          alert(this.json_data);
      })
      this.json_data = "before";
  }
  
   hello(){
      alert("hello");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This errror is thrown EXCEPTION: TypeError: this.hello is not a function. (In 'this.hello()', 'this.hello' is undefined)</p>
  
  <p>I have also noticed that there is a function built into type script called ajaxGetJSON. But my IDE does not provides docs for how to use this function and I cannot find docs online for it. Any help with this question would be great.</p>