title: Converting deeply nested json to java object and vice versa
body: <p>I am using JAXB for my json conversion to java object. The problem I am facing is that it leads me to create huge number of classes which serves no purpose except acting as a place holder for json tags. </p>
  
  <p>For example: Consider below json:</p>
  
  <pre><code>{
  "proposalAggregation": {
      "Buys": {
          "Heading1": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          },
          "Heading2": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          }
      },
      "Sells": {
          "Heading1": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          },
          "Heading2": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          }
      },
      "TAChanges": {
          "Heading1": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          },
          "Heading2": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          }
      },
      "Existing": {
          "Heading1": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          },
          "Heading2": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          }
      },
      "Proposed": {
          "Heading1": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          },
          "Heading2": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          }
      },
      "PIAChanges": {
          "Heading1": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          },
          "Heading2": {
              "key1": "value1",
              "key2": "value2",
              "key3": "value3"
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Now to deserialize this JSON as-is to java object these are the java classes i need to create:</p>
  
  <pre><code>Class ProposalAggregation --&gt; this contains Buys, sells, existing, porposed,TAChanges, PIA
  
  Class Buys extends Calculation
  Class Sells extends Calculation
  Class Existing extends Calculation
  Class proposed extends Calculation
  Class TAChanges extends Calculation
  Class PIAChanges extends Calculation 
  Class Calculation -- &gt; this contains heading1 and heading2
  
  class Heading1
  Class Heading2
  </code></pre>
  
  <p>So in total 9 classes to mimic above JSON and if we looks at the role of these classes they are nothing but place holders for JSON tags.
  Is there any easy way for this ?</p>