title: Handling unknown Json properties when mapping Json object to POJO
body: <p>I have a POJO looking something like this:</p>
  
  <pre><code>public class MyClass {
      public String sub;
      public String iss;
      public JsonObject customProperties;
  
      ..constructor, getters, setters..
  }
  </code></pre>
  
  <p>And a Json object looking something like this:</p>
  
  <pre><code>{
      "sub" : "value",
      "iss" : "value2",
      "unknown_property" : "value3",
      "unknown_property_2" : {
          "a" : 1,
          "b" : 2
      }
  }
  </code></pre>
  
  <p>What I would like to, is map the Json object to MyClass, where <strong>any unknown properties in the Json are added to the "customProperties" field</strong>. (NB! I can also have "customProperties" as a Map, but keep in mind that the objects are unknown and may be complex).</p>
  
  <p>A MyClass object would then look like:</p>
  
  <pre><code>sub = "value"
  iss = "value2"
  customProperties = {"unknown_property":"value3","unknown_property_2":{"a":1,"b":2}}
  </code></pre>
  
  <p>I was thinking I need a custom deserializer, but the things I have tried does not fulfill my needs, or my understanding/competence may be lacking.</p>
  
  <p>I can use google.gson or org.json, <em>not</em> jackson.</p>