title: How do you read a simple value out of some json using System.Text.Json?
body: <p>I have this json</p>
  
  <pre><code>{"id":"48e86841-f62c-42c9-ae20-b54ba8c35d6d"}
  </code></pre>
  
  <p>How do I get the <code>48e86841-f62c-42c9-ae20-b54ba8c35d6d</code> out of it? All examples I can find show to do something like</p>
  
  <pre><code>var o = System.Text.Json.JsonSerializer.Deserialize&lt;some-type&gt;(json);
  o.id // &lt;- here's the ID!
  </code></pre>
  
  <p>But I don't have a type that fits this definition and I don't want to create one. I've tried deserializing to dynamic but I was unable to get that working.</p>
  
  <pre><code>var result = System.Text.Json.JsonSerializer.Deserialize&lt;dynamic&gt;(json);
  result.id // &lt;-- An exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in System.Linq.Expressions.dll but was not handled in user code: ''System.Text.Json.JsonElement' does not contain a definition for 'id''
  </code></pre>
  
  <p>Can anyone give any suggestions?</p>
  
  <hr>
  
  <p>edit:</p>
  
  <p>I just figured out I can do this:</p>
  
  <pre><code>Guid id = System.Text.Json.JsonDocument.Parse(json).RootElement.GetProperty("id").GetGuid();
  </code></pre>
  
  <p>This does work - but is there a better way?</p>