title: C# Why does System.Text.Json doesnt deserialise string
body: <p>Given this model class:</p>
  <pre><code>    using System.Text.Json;
      public class QueueMessage
      {
          public int MerchantId { get; }
          public string Message { get; }
      }
  </code></pre>
  <p>When I try to deserialize a json string into the type QueueMessage, the fields are set to default. 0 and null.
  This is how I've tried to deserialize it:</p>
  <pre><code>var jsonString = &quot;{\&quot;MerchantId\&quot;:2,\&quot;Message\&quot;:\&quot;Message 2\&quot;}&quot;;
  QueueMessage message  = JsonSerializer.Deserialize&lt;QueueMessage&gt;(jsonString, new JsonSerializerOptions
          {
              PropertyNameCaseInsensitive = true
          });
  
  message.Message is null
  message.MerchantId is 0
  </code></pre>
  <p>I'm using .Net 5 by the way.</p>
  <p><strong>What have I tried</strong>
  Well i try to use my ol' buddy Newtonsoft.Json</p>
  <pre><code>dynamic message = JsonConvert.DeserializeObject(jsonString);
  dynamic mercId = message.MerchantId.Value; //THIS gives the expected value of 2
  </code></pre>
  <p>However,</p>
  <pre><code>QueueMessage msg = JsonConvert.DeserializeObject&lt;QueueMessage&gt;(jsonString);
  </code></pre>
  <p>Gives the 0, null result</p>
  <p>Now, the question is why does deserializing to a typed object fail?</p>