title: json Serialize/Deserialize property "object" with primitive .net types
body: <p>I have a class</p>
  <pre><code>        public class DataValue
          {
              public object Value { get; set; }
          }
  </code></pre>
  <p><em><strong>Value</strong></em> stores a <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/built-in-types" rel="nofollow noreferrer">Built-in types</a>. In the example below, it is <em><strong>ushort</strong></em>, but it can be any of the primitive types.</p>
  <pre><code>[Fact]
  public void DatapointValueTestNewtonsoft()
  {
      var dataValue = new DataValue
      {
         Value = (ushort) 12
      };
          
      var jsonTypeNameAll = JsonConvert.SerializeObject(dataValue, Formatting.Indented, new JsonSerializerSettings
      {
           TypeNameHandling = TypeNameHandling.All,
           ContractResolver = new CamelCasePropertyNamesContractResolver()
      });
  
      var dataValueDeserialized = JsonConvert.DeserializeObject&lt;DataValue&gt;(jsonTypeNameAll);
  }
  </code></pre>
  <p>After Serialize/Deserialize I get a long:
  <a href="https://i.stack.imgur.com/GbjrN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GbjrN.png" alt="enter image description here" /></a></p>
  <ol>
  <li>Is it possible to Serialize/Deserialize with correct types?</li>
  <li>If possible, how to do it?</li>
  </ol>