-->

signed

QiShunwang

“诚信为本、客户至上”

HQL解析json字符串

2021/6/3 17:29:44   来源:

函数:get_json_object(jsonStr,path)
json字符串格式如下:大字段名 big_string 表名:table1

{ 
    "bankId" : "003285689100", 
    "bangName" : "交通银行", 
    "creDate" : "2020-06-04", 
    "name" : "张三疯"
}

想要解析出对应key的value,可以使用如上函数

select get_json_object(big_string,'$.bankId') as bankId
	   ,get_json_object(big_string,'$.bangName') as bangName
	   ,get_json_object(big_string,'$.creDate') as creDate
	   ,get_json_object(big_string,'$.name') as name
from table1;
输出结果如下:
bankId		  bangName    creDate 		name
003285689100  交通银行    2020-06-04	    张三疯