title: KnockoutJS Populate observableArray using TypeScript
body: <p>How can I populate an observableArray (KnockoutJS) using TypeScript? I have a class as my ViewModel.</p>
  
  <p>Without TypeScript I would load the data using <code>$.getJSON();</code> and map it.</p>
  
  <pre><code>function ViewModel() {
      var self = this;
  
      self.list_data = ko.observableArray([]);
  
      $.getJSON('/Home/Get', function (data) {
          var mapped = $.map(data, function (obj) { return new AClass(obj); });
          self.list_data(mapped);
      });
  }
  </code></pre>
  
  <p>This is my class so far, I am loading the data in the constructor and get the JSON data array. I have tried to map it as well but no luck.</p>
  
  <p>How do I store/map it in the <code>list_data = ko.observableArray([]);</code> in the TypeScript class?</p>
  
  <pre><code>class MyViewModel {
      constructor() {
          $.getJSON('/Home/Get', function (data) {
              alert(data);
          });
      }
  
      list_data = ko.observableArray([]);
  }
  </code></pre>
  
  <p>Thanks</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Here is the data from the server:</p>
  
  <pre><code>[{ "Product": "102289", "ArtworkId": 19431, "IsDownloaded": 1 },
      { "Product": "272203", "ArtworkId": 19423, "IsDownloaded": 1 },
      { "Product": "272222", "ArtworkId": 20306, "IsDownloaded": 1 },
      { "Product": "332245", "ArtworkId": 19430, "IsDownloaded": 1 },
      { "Product": "382277", "ArtworkId": 19424, "IsDownloaded": 0 },
      { "Product": "382256", "ArtworkId": 19425, "IsDownloaded": 1 },
      { "Product": "392272", "ArtworkId": 19416, "IsDownloaded": 1 },
      { "Product": "422242", "ArtworkId": 19422, "IsDownloaded": 1 },
      { "Product": "452295", "ArtworkId": 19414, "IsDownloaded": 0 },
      { "Product": "452219", "ArtworkId": 19421, "IsDownloaded": 0 },
      { "Product": "452214", "ArtworkId": 19413, "IsDownloaded": 0 },
      { "Product": "452223", "ArtworkId": 19415, "IsDownloaded": 1 },
      { "Product": "632204", "ArtworkId": 20051, "IsDownloaded": 1 },
      { "Product": "632238", "ArtworkId": 19432, "IsDownloaded": 1 },
      { "Product": "632295", "ArtworkId": 19419, "IsDownloaded": 1 },
      { "Product": "712220", "ArtworkId": 19417, "IsDownloaded": 1 },
      { "Product": "722240", "ArtworkId": 19433, "IsDownloaded": 1 },
      { "Product": "762258", "ArtworkId": 20273, "IsDownloaded": 0 },
      { "Product": "762278", "ArtworkId": 20274, "IsDownloaded": 1 },
      { "Product": "792297", "ArtworkId": 19418, "IsDownloaded": 1 },
      { "Product": "812202", "ArtworkId": 19429, "IsDownloaded": 0 },
      { "Product": "862280", "ArtworkId": 19420, "IsDownloaded": 1 }]
  </code></pre>