@Override
  public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException {
    try {
      List<PartitionSpec> partitionSpecList = new ArrayList<PartitionSpec>();
      TDeserializer deserializer = new TDeserializer(new TJSONProtocol.Factory());
      for (String stringRep : hcatPartitionSpecStrings) {
        PartitionSpec partSpec = new PartitionSpec();
        deserializer.deserialize(partSpec, stringRep, "UTF-8");
        partitionSpecList.add(partSpec);
      }
      return new HCatPartitionSpec(null, PartitionSpecProxy.Factory.get(partitionSpecList));
    }
    catch (TException deserializationException) {
      throw new HCatException("Failed to deserialize!", deserializationException);
    }
  }
MetadataSerializer implementation, that serializes HCat API elements into JSON.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/MetadataJSONSerializer.java