title: Serialization of key/value pairs in Jackson?
body: <p>I have a class</p>
  
  <pre><code>class Foo {
    String key;
    String value;
  }
  </code></pre>
  
  <p>and want to serialize this into <code>"&lt;content of key&gt;":"&lt;content of value&gt;"</code>
  How can I achieve this (and how to deserialize <code>"myKey":"myVal"</code> into a <code>Foo</code>object?</p>
  
  <p>I was trying to use </p>
  
  <pre><code>@JsonValue
  public String toString() {
     return "\"" + key + "\":\"" + value + "\"";
  }
  </code></pre>
  
  <p>But clearly end up with too many quotes.</p>
  
  <pre><code>@JsonValue
  public String toString() {
      return key + ":" + value;
  }
  </code></pre>
  
  <p>also does not work, as it does not create enough quotes.</p>