public static <T> T fromJson(String json, TypeReference<T> typeRef) {
    Validate.notNull(json, "null JSON string");
    Validate.notNull(typeRef, "null type reference");
    T object;
    try {
      object = MAPPER.readValue(json, typeRef);
    } catch (IOException e) {
      String errorMessage = "Failed to parse json: " + json;
      LOG.error(errorMessage, e);
      throw new SamzaException(errorMessage, e);
    }
    return object;
  }
Deserialize a JSON string into an object based on a type reference.
This method allows the caller to specify precisely the desired output
type for the target object.
@param json JSON string
@param typeRef type reference of the target object
@param <T> type of the target object
@return deserialized Java object
samza-sql/src/main/java/org/apache/samza/sql/util/JsonUtil.java