title: ServiceStack Deserialize Json (with types) to List of specific type
body: <p>I have this json:</p>
  <pre><code>    {
      &quot;$type&quot;: &quot;System.Collections.Generic.List&lt;MyType&gt;&quot;,
      &quot;$values&quot;: [
          {
              &quot;$type&quot;: &quot;MyType&quot;,
              &quot;o&quot;: 7.54,
              &quot;t&quot;: 1619002800000,
              &quot;n&quot;: 3
          },
          {
              &quot;$type&quot;: &quot;MyType&quot;,
              &quot;o&quot;: 7.53,
              &quot;t&quot;: 1619005140000,
              &quot;n&quot;: 3
          }
      ]
  }
  </code></pre>
  <p>I want to deserialize it back into a <code>List&lt;MyType&gt;</code>.  I thought there would be an easy way to do that some thing like this:</p>
  <pre><code>var myList = json.FromJson&lt;MyType&gt;();
  </code></pre>
  <p>but that doesn't work.</p>
  <p>I have figured out a way to accomplish my goal but it's a bit messy so I was wondering if there's a better way that I'm not aware of.  Here's the messy way I came up with:</p>
  <pre><code>var myListOfObject = (List&lt;object&gt;)((Dictionary&lt;string, object&gt;)JSON.parse(json))[&quot;$values&quot;];
  var myTypes = myListOfObject.ConvertAll(x =&gt; JSON.stringify(x).FromJson&lt;MyType&gt;());
  </code></pre>
  <p>I'm not necessarily looking for fewer lines of code because 2 isn't anything to complain about.  I'm just hoping there is a way that doesn't require all the casting and parsing and rather can accept the json as is and get it back to the type it came from.  Maybe there's even a parameter I can set to tell it to validate types during the deserialization since the full type names are in the json.</p>