@Override
  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {

    checkArgsSize(arguments, 2, 2);
    checkArgPrimitive(arguments, 0);
    checkArgPrimitive(arguments, 1);
    if (!ObjectInspectorUtils.isConstantObjectInspector(arguments[1])) {
      throw new UDFArgumentTypeException(1, getFuncName() + " argument 2 may only be a constant");
    }

    inputConverter = new TextConverter((PrimitiveObjectInspector) arguments[0]);
    String typeStr = getConstantStringValue(arguments, 1);

    try {
      final TypeInfo t = TypeInfoUtils.getTypeInfoFromTypeString(typeStr);
      final ObjectInspector oi =
          TypeInfoUtils.getStandardWritableObjectInspectorFromTypeInfo(t);
      jsonReader = new HiveJsonReader(oi);
      jsonReader.enable(Feature.PRIMITIVE_TO_WRITABLE);
    } catch (Exception e) {
      throw new UDFArgumentException(getFuncName() + ": Error parsing typestring: " + e.getMessage());
    }

    return jsonReader.getObjectInspector();
  }
Parses a json string representation into a Hive struct.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFJsonRead.java