title: System.Text.Json.Serialization Does not appear to work for JSON with NESTED classes
body: <p>How do I define a class that works using only System.Text.Json.Serialization?</p>
  <p>Using Microsoft's new alternative to Newtonsoft deserialization does not currently work for nested classes, as all the properties are set to null when the JSON file is deserialized. Using Newtosonsoft's Json property attribute <code>[JsonProperty(&quot;Property1&quot;)]</code> maintains the properties' value.</p>
  <p>Thanks!</p>
  <pre><code>public class Class1
  {
      [JsonProperty(&quot;Property1&quot;)]
      public string Property1 { get; set; }
  }
      
  </code></pre>
  <p>Pasting using visual studio's paste JSON to class to create a class:</p>
  <pre><code>public class Rootobject
  {
      public string Database { get; set; }
      public Configuration Configuration { get; set; }
  }
  
  public class Configuration
  {
      public Class1 Class1 { get; set; }
      public Class2 Class2 { get; set; }
      public Class3 Class3 { get; set; }
  }
  
  public class Class1
  {
      public string Property1 { get; set; }
  }
  
  public class Class2
  {
      public string Property2 { get; set; }
  }
  
  public class Class3
  {
      public string Property3 { get; set; }
  }
  </code></pre>
  <p>Issue is when <a href="https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to?pivots=dotnet-5-0" rel="nofollow noreferrer">using System.Text.Json.Serialization</a> the nested class's properties are set to null.</p>
  <pre><code>{
    &quot;property1&quot;: null
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/v53mD.png" rel="nofollow noreferrer">csharp2json</a></p>
  <p>Using Newtonsoft deserializer works with <code>[JsonProperty(&quot;Configuration&quot;)]</code></p>
  <pre><code>public class Class1
  {
      [JsonProperty(&quot;Property1&quot;)]
      public string Property1 { get; set; }
  }
  
  public class Class2
  {
      [JsonProperty(&quot;Property2&quot;)]
      public string Property2 { get; set; }
  }
  
  public class Class3
  {
      [JsonProperty(&quot;Property3&quot;)]
      public string Property3 { get; set; }
  }
  
  public class Configuration
  {
      [JsonProperty(&quot;Class1&quot;)]
      public Class1 Class1 { get; set; }
  
      [JsonProperty(&quot;Class2&quot;)]
      public Class2 Class2 { get; set; }
  
      [JsonProperty(&quot;Class3&quot;)]
      public Class3 Class3 { get; set; }
  }
  
  public class RootObject
  {
      [JsonProperty(&quot;Database&quot;)]
      public string Database { get; set; }
  
      [JsonProperty(&quot;Configuration&quot;)]
      public Configuration Configuration { get; set; }
  }
  </code></pre>