title: Why different behavior between ASP.NET Web API 2 & ASP.NET Core 3.1 Web API?
body: <p>I am posting below data to 2 different api endpoints, one we have in an ASP.NET Web API 2 application and while other I have in an ASP.NET Core 3.1 Web API application.</p>
  <pre><code>var data = new Data
              {
                  Key = &quot;k1&quot;,
                  Value = 80
              };
  
  IClient httpClient = new FluentClient(&quot;http://localhost:46551/&quot;);
  var x = httpClient.PostAsync(&quot;weatherforecast&quot;, data).GetAwaiter().GetResult();
  </code></pre>
  <p>For both Web API applications, my model class is below where <code>Value</code> is <code>object</code> type and this is my hard requirement, I can't go with actual type.</p>
  <pre><code>public class Data
  {
      public string Key { get; set; }
      public object Value { get; set; }
  }
  </code></pre>
  <p>When I am posting data to ASP.NET Web API 2 (with .Net 4.6.1), the VS debugger shows only value correctly without any other payload:</p>
  <p><a href="https://i.stack.imgur.com/5XsEg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5XsEg.png" alt="enter image description here" /></a></p>
  <p>But for ASP.NET Core 3.1 Web API, the VS debugger shows like this, totally different representation along with <code>ValueKind</code>:</p>
  <p><a href="https://i.stack.imgur.com/CFMex.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CFMex.png" alt="enter image description here" /></a></p>
  <p>I have a requirement to write <code>data</code> into Json format with below expected output,</p>
  <pre><code>{ &quot;Key&quot;:&quot;k1&quot;, &quot;Value&quot;:80 }
  </code></pre>
  <p>While I am trying to serialize <code>data</code> for the ASP.NET Core 3.1 Web API, I get this output:</p>
  <pre><code>var ser = JsonConvert.SerializeObject(data);
  
  { &quot;Key&quot;:&quot;k1&quot;, &quot;Value&quot;: {&quot;ValueKind&quot;:4} }
  </code></pre>
  <p>For the ASP.NET Web API 2 application, though I am getting expected output.</p>
  <p>Question, how to get this output <code>{ &quot;Key&quot;:&quot;k1&quot;, &quot;Value&quot;:80 }</code> from the ASP.NET Core 3.1 application and why there is a different behavior from both applications?</p>
  <p>Thanks,</p>