Saturday, March 31, 2018

Parsing Value from a Json Field in Qubole.

When the data in one of the Filed in the hive env is in Json format and when we need to extract the value out of the Json we can use the following commands

get_json_object(column_name, '$.keyvalue')

The column name is : jdata and json the Column is as followes.

{
    "Foo": "ABC",
    "Bar": "20090101100000",
    "Quux": {
        "QuuxId": 1234,
        "QuuxName": "Sam"
    }
}

if we have to extract ABC : get_json_object(jdata, '$.Foo') 

No comments:

Post a Comment