title: How can I store key-value pairs in JSON to be deserialized in Java?
body: <p>I have data in JSON like so:</p>
  
  <pre><code>{
      "foo": "bar",
      "key": true,
      "otherKey": 10
  }
  </code></pre>
  
  <p>The key is a String and the value is a primitive (int, float, double, long, etc.) or a String. I want a simple, cast-free wrapper for each of the above.</p>
  
  <p>Here's my wrapper class:</p>
  
  <pre><code>public final class Wrapper&lt;T&gt; {
  
      private String key;
      private T value;
  
  }
  </code></pre>
  
  <p>If I specified <code>Wrapper[] wrappedValues</code> in an object to be deserialized, could I (using Jackson or GSON) deserialize the map to a list of the wrapper?</p>
  
  <p>Thanks for any replies!</p>