title: Java GSON check data
body: <p>I'm having trouble with gson:</p>
  
  <p>For example I have this output from website:</p>
  
  <p><code>[["connected"], ["user1":"Hello"], ["user2":"Hey"], ["disconnected"]]</code></p>
  
  <p>But I want parse this JSON and output something like this:</p>
  
  <pre><code>connected
  user1 says: Hello
  user2 says: Hey
  disconnected
  </code></pre>
  
  <p>I quicly wrote this code:</p>
  
  <pre><code>public static void PrintEvents(String id){
      String response = Post.getResponse(Server()+"events?id="+id,"");
      // response is [["connected"],["user1":"Hello"],["user2":"Hey"],["disconnected"]]
  
      JsonElement parse = (new JsonParser()).parse(response); //found this in internet
  
      int bound = ????????????; // Should be 4
  
      for (int i=1;i&lt;=bound;i++){
           String data = ???????????;
           if (data == "connected" || data == "disconnected") then {
              System.out.println(data);
           }else if(?????==2){// to check how many strings there is, if it's ["abc","def"] or ["abc"]
              String data2 = ??????????????;
              System.out.println(data+" says: "+data2);
           }else{
              //something else
           }
      };
  
  }
  </code></pre>
  
  <p>What should I insert to these parts with question marks to make code work?</p>
  
  <p>I cannot find any way to make it work...</p>
  
  <p><em>Sorry for my bad English.</em></p>
  
  <p><strong>EDIT:</strong> Changed response to <code>[["connected"], ["user1","Hello"], ["user2","Hey"], ["disconnected"]]</code>. Earlier response was not valid JSON.</p>