title: Jackson parse different level fields to one java class
body: <p>I have the following JSON string and java class.
  Json:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;records&quot;: [
          {
              &quot;metadata&quot;: {
                  &quot;id&quot;: &quot;1129836408668&quot;,
                  &quot;partition&quot;: &quot;ecp:9-ca69437a-2ad5-4233-bfc4-fd9aa049569d&quot;,
                  &quot;version&quot;: &quot;ecp:9-f66cf504-ba65-48a9-91c0-d1d8229e4899&quot;,
                  &quot;currentAt&quot;: &quot;2021-12-07T11:13:50.699Z&quot;
              },
              &quot;state&quot;: {
                  &quot;effectiveFrom&quot;: &quot;2021-12-14T06:35:09.063Z&quot;,
                  &quot;effectiveTo&quot;: &quot;2021-12-14T06:35:09.063Z&quot;,
                  &quot;currentFrom&quot;: &quot;2021-12-14T06:35:09.063Z&quot;,
                  &quot;currentTo&quot;: &quot;2021-12-14T06:35:09.063Z&quot;,
                  &quot;dataItem&quot;: {
                      &quot;ModifiedDate&quot;: &quot;2021-12-07T11:13:44.099Z&quot;,
                      &quot;ObjectId&quot;: &quot;1129836408668&quot;,
                      &quot;ChangeFlag&quot;: &quot;&quot;,
                      &quot;IsUnconfirmed&quot;: &quot;false&quot;,
                      &quot;CreatedDate&quot;: &quot;2021-12-07T11:13:44.099Z&quot;
                  }
              }
          }
      ],
      &quot;index&quot;: null
  }
  </code></pre>
  <p>Class A:</p>
  <pre class="lang-java prettyprint-override"><code>public class ParentClass {
      
      private Date effectiveFrom;
      private Date effectiveTo;
      private Date currentFrom;
      private Date currentTo;
      private String id;
  }
  </code></pre>
  <p>Class B</p>
  <pre class="lang-java prettyprint-override"><code>public class ChildClass extends ParentClass {
      
      @JsonProperty(&quot;ModifiedDate&quot;)
      private Date ModifiedDate;
      
      @JsonProperty(&quot;ObjectId&quot;)
      private String ObjectId;
      
      @JsonProperty(&quot;ChangeFlag&quot;)
      private String ChangeFlag;
      
      @JsonProperty(&quot;IsUnconfirmed&quot;)
      private String IsUnconfirmed;
      
      @JsonProperty(&quot;CreatedDate&quot;)
      private Date CreatedDate;
      
  }
  </code></pre>
  <p>And I'd like to parse the values in <code>state</code> jsonnode to <code>ChildClass</code> wiht Jackson. Which way is the best way to do it.
  My thoughts is trying to parse <code>state</code> into MapA, and then parse <code>dateItem</code> into MapB, then merge MapB to MapA, you will get a Mapc, and then parse MapC to <code>ChildClass</code>. However, I think this is not a efficiency way to do it. So will you guys have a better solution.</p>
  <p>MapC:</p>
  <pre><code>{
  effectiveFrom=2021-12-14T06:35:09.063Z, 
  effectiveTo=2021-12-14T06:35:09.063Z, 
  currentFrom=2021-12-14T06:35:09.063Z, 
  currentTo=2021-12-14T06:35:09.063Z, 
  ModifiedDate=2021-12-07T11:13:44.099Z, 
  ObjectId=1129836408668, 
  ChangeFlag=, IsUnconfirmed=false, 
  CreatedDate=2021-12-07T11:13:44.099Z
  }
  </code></pre>