org.apache.hadoop.hive.ql.udf
Class UDFJson
java.lang.Object
org.apache.hadoop.hive.ql.exec.UDF
org.apache.hadoop.hive.ql.udf.UDFJson
public class UDFJson
- extends UDF
Method Summary |
String |
evaluate(String jsonString,
String pathString)
Extract json object from a json string based on json path specified,
and return json string of the extracted json object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UDFJson
public UDFJson()
evaluate
public String evaluate(String jsonString,
String pathString)
- Extract json object from a json string based on json path specified,
and return json string of the extracted json object. It will return null
if the input json string is invalid.
A limited version of JSONPath supported:
$ : Root object
. : Child operator
[] : Subscript operator for array
* : Wildcard for []
Syntax not supported that's worth noticing:
'' : Zero length string as key
.. : Recursive descent
@ : Current object/element
() : Script expression
?() : Filter (script) expression.
[,] : Union operator
[start:end:step] : array slice operator
- Parameters:
jsonString
- the json string.pathString
- the json path expression.
- Returns:
- json string or null when error happens.
Copyright © 2009 The Apache Software Foundation