title: Inheritance in JSON Config File in Java
body: <p>I have an API which takes the details from a config file in JSON . eg</p>
  <pre><code>  &quot;sections&quot;: {
      &quot;Vehicles&quot;: [&quot;Car &quot;, &quot;Bus&quot;,],
      &quot;Air transport&quot;: [&quot;Helicopter&quot;, &quot;Aeroplanes &quot;],
      
    },
    &quot;sectionItems&quot;: {
       &quot;Car&quot;: [&quot;Small&quot;,&quot;4 seat&quot;,&quot;private&quot;],
       &quot;Bus&quot;: [&quot;Big&quot;, &quot;20 seat&quot;, &quot;passenger&quot;, &quot;etc&quot;],
       &quot;Helicopter&quot;: [&quot;Blades&quot;, &quot;straight&quot;, &quot;etc&quot;],
       &quot;Aeroplane&quot;:[&quot;cargo &quot;,&quot;wings &quot;,&quot;etc&quot;]
  ...
  }
  </code></pre>
  <p>Now I want to change it according to my API . Lets say I need v1 and v2.
  So there will be a base parent config file which will contain the common objects</p>
  <pre><code>  &quot;sections&quot;: {
      &quot;Vehicles&quot;: [&quot;Car &quot;, &quot;Bus&quot;,],
      &quot;Air transport&quot;: [&quot;Helicopter&quot;, &quot;Aeroplanes &quot;],
      &quot;C&quot;: [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;],
    },
    &quot;sectionItems&quot;: {
       &quot;Car&quot;: [&quot;Small&quot;,&quot;4 seat&quot;,&quot;private&quot;],
      
       &quot;Helicopter&quot;: [&quot;Blades&quot;, &quot;straight&quot;, &quot;etc&quot;],
       
  ...
  }
  
  </code></pre>
  <p><em>Bus and Aeroplanes is missing</em></p>
  <p>Two v1 and v2 config file that will contain the only respective changes that are required to avoid duplicates .</p>
  <p><strong>V1</strong></p>
  <pre><code>  &quot;sectionItems&quot;: {
       &quot;Bus&quot;: [&quot;20 seat&quot; &quot;etc&quot;],
      
       &quot;Aeroplane&quot;:[&quot;wings &quot;,&quot;etc&quot;]
       }
  }
  
  </code></pre>
  <p><strong>V2</strong></p>
  <pre><code>  &quot;sectionItems&quot;: {
       &quot;Bus&quot;: [&quot;Big&quot;, &quot;20 seat&quot;, &quot;passenger&quot;, &quot;etc&quot;],
       &quot;Aeroplane&quot;:[&quot;cargo &quot;,&quot;wings &quot;,&quot;etc&quot;]
  }
  }
  </code></pre>
  <p>How can i achieve this using ?</p>