Code example for JsonObject

Methods: add

   * Static implementation-independent GSON serializer. Call this from 
   * {@link #toGson} to avoid subclassing issues with inner message types. 
  public static JsonElement toGsonHelper(RobotSearchDigest message, RawStringData raw, Gson gson) {
    JsonObject json = new JsonObject();
    json.add("1", new JsonPrimitive(message.getWaveId()));
      JsonArray array = new JsonArray();
      for (int i = 0; i < message.getParticipantSize(); i++) {
        array.add(new JsonPrimitive(message.getParticipant(i)));
      json.add("2", array);
    json.add("3", new JsonPrimitive(message.getTitle()));
    json.add("4", new JsonPrimitive(message.getSnippet()));
    json.add("5", GsonUtil.toJson(message.getLastModifiedMillis()));
    json.add("6", new JsonPrimitive(message.getBlipCount()));
    json.add("7", new JsonPrimitive(message.getUnreadBlipCount()));
    return json;
  public void fromGson(JsonElement json, Gson gson, RawStringData raw) throws GsonException {