title: deserialize json string with gson
body: <p>My java servlet returns a json string in this way:</p>
  
  <pre><code>Gson gson = new Gson();     
  String lista = gson.toJson(utenti);
  System.out.println(lista);
  request.setAttribute("lista", lista);
  request.getRequestDispatcher("GestioneUtenti.jsp").forward(request, response);
  </code></pre>
  
  <p>now, in the jsp page I want to have my arrayList again. I try to do this:</p>
  
  <pre><code>&lt;%
  String lista = (String)request.getAttribute("lista");
  Gson gson = new Gson();
  ArrayList&lt;Utente&gt; users = gson.fromJson(lista, TypeToken.get(new ArrayList&lt;Utente&gt;().getClass()).getType());        
  out.println(users.get(0).getUsername());
  %&gt;
  </code></pre>
  
  <p>I have this exception:</p>
  
  <pre><code>java.lang.ClassCastException: com.google.gson.internal.StringMap cannot be cast to classi.Utente
  </code></pre>
  
  <p>can Youu help me? If i miss some particulars tell me! thanks :-)</p>