title: I cant parse this JSON code, how could i do it?
body: <p>I need help with this JSON parser. I have one container with comments which i want to get. This is the JSON string-code that i have: <a href="http://www.jsoneditoronline.org/?id=b73dc60acd235f60a647c02ed3e068db" rel="nofollow">http://www.jsoneditoronline.org/?id=b73dc60acd235f60a647c02ed3e068db</a>
  I need to get the atributes  from each comment of the "resources" field (content, id, creator). I have tried this, between another things, and i cant obtain that i want. </p>
  
  <pre><code>public class CommentsParser {
  
      public List&lt;Comment&gt; readJsonStream(InputStream in) throws IOException {
          // Nueva instancia JsonReader
          System.out.println("Longitud del inputStream para comentarios: "+ in.toString().length());
          //Vemos lo que ha leido del inputStream
          JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
          StringWriter writer = new StringWriter();
          IOUtils.copy(in, writer, "UTF-8");
          String linea = writer.toString();
          System.out.println("El is contiene: "+linea); // Lo que recibe en el inputStream
          //Vemos lo que ha leido del reader.
          System.out.println("El reader contiene: "+ reader.toString());
          try {
              // Leer Array
              return leeArrayComentarios(reader);
          } finally {
              reader.close();
          }
  
      }
      public List&lt;Comment&gt; leeArrayComentarios(JsonReader reader) throws IOException {
          // Lista temporal 
          List&lt;Comment&gt; listaComentarios = new ArrayList&lt;Comment&gt;();
  
          listaComentarios = formatComentario(reader);
  
          return listaComentarios;
  
      }
  
      public List&lt;Comment&gt; formatComentario(JsonReader reader) throws IOException {
  
          List&lt;Comment&gt; listaComentarios = new ArrayList&lt;Comment&gt;();
          String situacion;
          Comment comentario = new Comment();
          //System.out.println("Estamos en: "+ reader.nextString());
          //System.out.println("Estamos en: "+ reader.nextName());
  
          //reader.beginObject();
          while (reader.hasNext()) {
              String campo = reader.nextName();
              System.out.println("El objeto es:"+campo);
              switch (campo) { //Cuando intenta parsear no encuentra estos case y entonces devuelve a null el usuario.
                  /*case "content":
                      Name nombre = new Name();
                      comentario.setContent(reader.nextString());
                      break;
                  case "isRecomment":
                      comentario.setIsRecomment(reader.nextBoolean());
                      break;
                  case "creator":
                      ActiveElement creador = new ActiveElement();
                      creador.setId(reader.nextLong());
                      comentario.setCreator(creador);*/
              case "_embebed":
                  situacion = reader.nextName(); //Deberiamos pasar a resources
                  //Una vez en resources tenemos una array de comentarios.
  
                  System.out.println("Estamos en: "+ reader.nextString());
                  reader.beginArray();
                  while (reader.hasNext()) {
                      // Leer objeto
                      System.out.println("Dentro While.Estamos en: "+ reader.nextName());
                  }
                  default:
                      reader.skipValue();
                      break;
              }
          }
          reader.endObject();
          return listaComentarios;
      }
  </code></pre>
  
  <p>}</p>
  
  <p>Edit 1 - Applying Gson:</p>
  
  <pre><code>public CommentContainer jsonToJava(String json){
          CommentContainer contenedor = new CommentContainer();
          Gson gson = new Gson();
          contenedor = gson.fromJson(json, CommentContainer.class);
          return contenedor;
      }
  </code></pre>
  
  <p>With this way, the CommentContainer i return is empty. The Json string is wellformed, as you can see in the URL of JsonEditor. </p>
  
  <p>I dont want the solution, only the way with i can get these atributes for save them into an object. Thanks a lot.</p>