title: Dynamic retrieve json element .NET 6
body: <p>I want to retrieve a single value from a json string.</p>
  <p>Previously I used <code>Newtonsoft</code> like this:</p>
  <pre><code>var jsonString = @&quot;{ &quot;&quot;MyProp&quot;&quot; : 5 }&quot;;
  dynamic obj = Newtonsoft.Json.Linq.JObject.Parse(jsonString);
          
  Console.WriteLine(obj[&quot;MyProp&quot;].ToString());
  
  </code></pre>
  <p>But I can't seem to get it to work in .NET 6:</p>
  <p>I've tried this so far:</p>
  <pre><code>var jsonString = @&quot;{ &quot;&quot;MyProp&quot;&quot; : 5 }&quot;;
  dynamic obj = await System.Text.Json.JsonSerializer.Deserialize&lt;dynamic&gt;(jsonString);
          
  Console.WriteLine(obj.MyProp.ToString());
  </code></pre>
  <p>which results in this error:</p>
  <blockquote>
  <p>Unhandled exception. Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'System.Text.Json.JsonElement.this[int]' has some invalid arguments</p>
  </blockquote>