title: convert list into JSON Format in spring
body: <p>How can i get json data by using criteria projection in spring MVC project.
  My Criteria Query as follows.</p>
  
  <pre><code>public List&lt;Item&gt; getProduct() {
      Criteria crit = session.createCriteria(Item.class);
      ProjectionList projList = Projections.projectionList();
      projList.add(Projections.property("item_code"));
      projList.add(Projections.property("item_name"));
      crit.setProjection(projList);
      List&lt;Item&gt; results = crit.list();
  }
  </code></pre>
  
  <p>My Controller Class as Follows</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.GET, produces = "application/json")
      public @ResponseBody List&lt;Item&gt; ProductList() {
          List&lt;Item&gt; productList = poService.getProduct();
           Gson gson = new GsonBuilder().serializeNulls().create();
           System.out.println("json = " + gson.toJson(productList));
          return productList;
      }
  </code></pre>
  
  <p>Output for this is</p>
  
  <pre><code>[[3,"CELLO PINPOINT"],[5,"JOHNSON BUDS 30"],[7,"SMALL WONDER FEEDING BOTTLE 125 ML"],[45,"YERA GLASS TUMBLER T70 6PC"],[1623,"PEPSI 500 ML"],[1816,"FOOD CHOPPER"],[1819,"SCREW SET"],[5653,"AMUL KOOL200ML"]]
  </code></pre>
  
  <p>Facing issue as not getting output as json format.</p>