title: Typescript JSON string to class
body: <p>Let be this JSON string:</p>
  
  <pre><code>[
      {
          "id": 1,
          "text": "Jon Doe"
      },
      {
          "id": 1,
          "text": "Pablo Escobar"
      }
  ]
  </code></pre>
  
  <p>Let be this class:</p>
  
  <pre><code>export class MyObject{
      id: number;
      text: string;
  }
  </code></pre>
  
  <p>How can I cast this JSON string to list of <code>MyObject</code>?</p>
  
  <p>If I do:</p>
  
  <pre><code>console.log(&lt;MyObject[]&gt;JSON.parse(json_string));
  </code></pre>
  
  <p>It returns a list of <code>Object</code> instead of a list of <code>MyObject</code></p>