public static JsonElement toJsonElement(MessageOrBuilder messageOrBuilder, boolean removeType)
    throws InvalidProtocolBufferException {
    String jsonString = toJsonString(messageOrBuilder);
    JsonParser parser = new JsonParser();
    JsonElement element = parser.parse(jsonString);
    if (removeType) {
      removeTypeFromJson(element);
    }
    return element;
  }
This class converts PB Messages to various representations, like:
<ul>
<li>JSON string: {@link #toJsonElement(MessageOrBuilder)}</li>
<li>JSON object (gson): {@link #toJsonElement(MessageOrBuilder)}</li>
<li>Java objects (Boolean, Number, String, List, Map): {@link #toJavaObject(JsonElement)}</li>
</ul>
hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMessageConverter.java