Hive解析嵌套Json用get_json_object
数据是string类型,拆分的时候get_json_object的逗号后要加个空格
{"KdProjCode":"A20160518015NB","DTjType":"调价","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","PriceHzInfo":{"Item":{"HzAmountAfter":1.0190920349E10,"HzAmountBefore":1.0190805449E10}},"TITLE":"宁波上湖城章","PriceCompareDetails":""}
查询不嵌套字段 (json外加上单引号)
select get_json_object('{"KdProjCode":"A20160518015NB","DTjType":"调价","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","PriceHzInfo":{"Item":{"HzAmountAfter":1.0190920349E10,"HzAmountBefore":1.0190805449E10}},"TITLE":"宁波上湖城章","PriceCompareDetails":""}', '$.KdProjCode')
得到A201605180