title: JSON consumer of polymorphic objects
body: <p>I am parsing JSON and am having difficulty with one structure that can have one of three forms. In my case it could be zero-dimensional, one-dimensional or two-dimensional. Is there some way I can inspect the JSON on the fly to determine which one it is? Or perhaps consume it anyway and work out what it is afterwards.</p>
  
  <p>The structures look like this and can be embedded in other structures.</p>
  
  <pre><code>"details":{
      "Product":"A zero-dimensional Product"
  },
  
  "details":{
      "Product":"A one-dimensional Product",
      "Dimensions": [ "Size" ],
      "Labels": [ "XS", "S", "M", "L" ]
  },
  
  "details":{
      "Product":"A two-dimensional Product",
      "Dimensions": [ "Size", "Fit" ],
      "Labels": [[ "XS", "S", "M", "L" ],[ "26", "28", "30", "32" ]]
  }
  </code></pre>
  
  <p>What I may be looking for is a generic class that Jackson will always match with.</p>
  
  <p>Something like translating:</p>
  
  <pre><code>{
  "SomeField": "SomeValue",
  ...
   "details":{
    ...
   }
  }
  </code></pre>
  
  <p>Into:</p>
  
  <pre><code>class MyClass {
    String SomeField;
    ...
    AClass details;
  }
  </code></pre>
  
  <p>Is there a class <code>AClass</code> I can define that could be a universal recipient for any JSON structure or array?</p>