title: C# Convert object type to specific business type
body: <p>I have a C# object with an Object parameter like this:</p>
  <pre><code>public  class Book
  {
  public object Parameter{get;set;}
  }
  </code></pre>
  <p>The Parameter object gets set to an object type of &quot;Author&quot;. If you inspect Parameter property, you will see it's of Author type. GetType() will also return Author.</p>
  <p>I need to clone Parameter and get a fresh instance of it. So I used this clone extension method:</p>
  <pre><code>    public static T Clone&lt;T&gt;(this T source)
      {
          return JsonSerializer.Deserialize&lt;T&gt;(JsonSerializer.Serialize(source));
      }
  var newAuthor = _book.Parameter.Clone();
  </code></pre>
  <p>But because the Parameter is of Object, the Clone method returns &quot;JsonElement&quot; for newAuthor. I researched and this is expected for any &quot;Object&quot; type.</p>
  <p>My question is -- how do I clone the Parameter object and actually return a new instance of Author object? The object is fairly simply with just properties.</p>
  <p>Thanks!</p>