一、解析json对象
1、单层
select get_json_object(params,'$.key')
示例:
select stu_id
,get_json_object(score,'$.corse_name') as corse_name
,get_json_object(score,'$.score') as score
from
(
select 1 as stu_id,'{"corse_name":"c++","score":10}' as score
)a
结果:
stu_id | corse_name | score |
1 | c++ | 10 |
2、嵌套多层
select stu_id
,get_json_object(score,'$.family_info') as family_info
,get_json_object(score,'$.family_info.ba') as