title: Deserialize JSON Object with arrays in Typescript
body: <p>I want to deserialize a <code>JSON</code> Object in <code>Typescript</code>. I have found this relevant <a href="https://stackoverflow.com/questions/22885995/how-do-i-initialize-a-typescript-object-with-a-json-object">question</a> I would like to use the <code>approach 4</code> of the accepted answer. However I am not sure if this would work in my case, since the object has member of <code>arrays</code> of other objects and so do the objects in the <code>array</code> as well. Moreover I would like to use a generic method/approach which deserializes the objects even if one does not know where the object dependencies end. The object structure looks like:</p>
  
  <pre><code>class Parent {
  
  s: string;
  x: number;
  children : Array&lt;Child1&gt;
  ...
  
  } 
  
  class Child1 {
  
  t: string;
  y: number;
  children : Array&lt;Child2&gt;
  ...
  
  }
  
  class Child2 {
  
  k: string;
  z: number;
  children : Array&lt;Child3&gt;;
  ...
  
  }
  
  ...
  </code></pre>
  
  <p>How can I deserialize these type of objects? I would be satisfied even with an approach which takes the end of the object structure for granted.</p>