@Override
  public String serializeTable(HCatTable hcatTable) throws HCatException {
    try {
      return new TSerializer(new TJSONProtocol.Factory())
          .toString(hcatTable.toHiveTable());
    }
    catch (TException exception) {
      throw new HCatException("Could not serialize HCatTable: " + hcatTable, exception);
    }
  }
MetadataSerializer implementation, that serializes HCat API elements into JSON.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/MetadataJSONSerializer.java