title: serializing List for Restlet using Jackson
body: <p>I am interfacing to a library. I get <code>List&lt;List&gt; foodItemsList</code></p>
  
  <p>How do I serialize <code>foodItemsList</code> using Jackson? This is happening while handling a GET.</p>
  
  <p>I have understood how to serialize an object using Jackson/Restlet, but I am unable to figure it out for a list.</p>
  
  <p>For a single object here is what I do</p>
  
  <pre><code>@Get("json")
  public Representation represent(Variant variant) throws ResourceException {
      :
      ObjectMapper mapper = new ObjectMapper(); 
      String myFinString = mapper.writeValueAsString(profileSupportedInfo);
      :
      return myFinstring
  }
  </code></pre>
  
  <p>getter setter for member data in profileSupportedInfo is what I provide.</p>
  
  <p>Before creating mapper object, here is the call I make</p>
  
  <pre><code>List&lt;List&gt; totalfoodItem = someMemberFunc();
  ObjectMapper mapper = new ObjectMapper
  // my question - how do I serialize totalFoodItem
  </code></pre>
  
  <p>The preferred representation of <code>totalFoodItem</code> in JSON is as given below</p>
  
  <pre><code>{
   "food":[
         {"name":"apple","img_loc":"123_apple.jpg","energ":210,"food_unit":"1"},
         {"name":"rice","img_loc":"134_rice.jpg","energ":123,"food_unit":"100 gm"},
         :
     ]
  }
  </code></pre>
  
  <p>What am I missing / failing to understand? 
  Thank you</p>