title: Jackson Library JSON Mapper to String
body: <p>I have a class (<code>A</code> and <code>B</code> are my objects)</p>
  
  <pre><code>public A   {
      private List&lt;B&gt; b;
      private int c;
  }
  </code></pre>
  
  <p>I have a String variable temp. So i would save in this variable the JSON String of my object. How?</p>
  
  <p>I've tried with this 2 method, but without result.</p>
  
  <pre><code>public void save() {
      ObjectMapper mapper = new ObjectMapper();
      String temp = mapper.writeValueAsString(a);
  }
  public void read(String temp) {
      ObjectMapper mapper = new ObjectMapper();
      A a = mapper.readValue(temp, A.class);
  }
  </code></pre>
  
  <p>How can I solve it?</p>