title: Serializing a pojo as a nested JSON dictionary
body: <p>Given the simple <code>POJO</code>:</p>
  
  <pre><code>public class SimplePojo {
      private String key ;
      private String value ;
      private int thing1 ;
      private boolean thing2;
  
      public String getKey() {
             return key;
      }
      ...
  }
  
  </code></pre>
  
  <p>I have no issue in serializing into something like so (using <code>Jackson</code>):</p>
  
  <pre><code> {
      "key": "theKey",
      "value": "theValue",
      "thing1": 123,
      "thing2": true
    }
  </code></pre>
  
  <p>but what would really make me happy is if I could serialize that object as such:</p>
  
  <pre><code> {
      "theKey" {
             "value": "theValue",
              "thing1": 123,
              "thing2": true
       }
    }
  </code></pre>
  
  <p>I'm thinking I would need a custom serializer, but where I'm challenged is in inserting a new dictionary, e.g.:</p>
  
  <pre><code>@Override
  public void serialize(SimplePojo value, JsonGenerator gen, SerializerProvider provider) throws IOException {
      gen.writeStartObject();
      gen.writeNumberField(value.getKey(), &lt;&lt; Here be a new object with the remaining three properties &gt;&gt; );
  
  
  }
  </code></pre>
  
  <p>Any suggestions?</p>