title: Delphi REST.JSON TJson.JsonToObject Problem with inheritance
body: <p>I would like to use the REST.JSON Librairy to convert an Object to a JSON-String and back, but i'm encountering some problems.</p>
  
  <p>Let's say the classes i would like to convert is "TFooChild1" and "TFooChild2" which both descend from "TFoo".
  The classes look like this: </p>
  
  <pre><code>TFoo = class
  protected
    Name: string;
    Value: Double;
  end;
  
  TFooChild1 = class(TFoo)
  private
    Limit: Double;
  end;
  
  TFooChild2 = class(TFoo)
  private
    Limit: Double;
    WorkerID: Integer;
  end;
  </code></pre>
  
  <p>Creating and converting to JSON would look something like this:</p>
  
  <pre><code>var
    Foo: TFoo;
    s: string;
  begin
    Foo := TFooChild1.Create;
    Foo.Name:= '...';
    ... //assign all the Fields
    s := TJson.ObjectToJsonString(Foo);
    Foo.Free;
  
    //conversion to string is correct...
  
    Foo := TJson.JsonToObject&lt;TFoo&gt;(s, []);
    //Field "Limit" is lost
  end
  </code></pre>
  
  <p>I'm aware that this (<code>TJson.JsonToObject&lt;TFoo&gt;(s, [])</code>) would never return the type TFooChild1, but that's exactly what i need. </p>
  
  <p>When you convert back to an Object, the Fields of the child classes are lost. How do I avoid this? I can't do <code>JsonToObject&lt;TFooChild1&gt;</code> because I don't know if it's gonna be Child1 or Child2.
  Any hints? </p>
  
  <p>I've googled if there's maybe a ConvertOption that would include Type information, but i haven't found anything</p>