Code example for JsonParser

Methods: parse

0
  } 
 
  public static Status fromJson(String json) {
    Preconditions.checkNotNull(json);
 
    JsonObject obj = (JsonObject) parser.parse(json);
 
    Status status = new Status();
    status.text = obj.get("text").getAsString();
    status.id = obj.get("id").getAsLong();
    status.screenname = obj.get("user").getAsJsonObject().get("screen_name").getAsString();
    status.createdAt = obj.get("created_at").getAsString();
 
    // TODO: We need to parse out the other fields. 
 
    status.jsonObject = obj;
    status.jsonString = json;
 
    return status;
  }