title: Parsing JSON from Typescript restores data members but not type: cannot call methods on result
body: <p>When I parse the JSON-stringified result of an object p1 back into another object p2, the second object gets the data associated with the first object, but I cannot call any nethods on it. Using <a href="http://www.typescriptlang.org/Playground/">http://www.typescriptlang.org/Playground/</a> I tried the following:</p>
  
  <pre><code>class Person
  {
      constructor(public name: string, public age: number) {
      }
      Age() { return this.age; }
  }
  
  // Create a person
  var p: Person = new Person("One", 1);
  
  // Create a second person from the JSON representation
  // of the first (NOTE: assert it is of type Person!)
  var p2: Person = &lt;Person&gt;JSON.parse(JSON.stringify(p));
  
  document.writeln("Start");
  
  document.writeln(p.name);  // OK: One
  document.writeln(p.Age()); // OK: 1
  
  document.writeln(p2.name); // OK: One
  document.writeln(p2.age;   // OK: 1
  document.writeln(p2.Age()); // ERROR: no method Age() on Object
  
  document.writeln("End");
  </code></pre>
  
  <p>How do I parse the JSON data and get a proper Person object?</p>