1、如果只有一级json,可以用A->'$.B'的方式提取
等同于
json_extract(A,'$.B') ===> extend_info = {"age":1089,"name":"tom"}
例如:
select json_extract(extend_info,'$.name') as age from dfcv_vps_plus_api_vehicle_monitor_terminalstatus where chassis_new ='N9002199'
结果: "tom"
例如:
select area_code->'$.name' as age from dfcv_vps_plus_api_vehicle_monitor_terminalstatus where chassis_new ='N9002199';
结果: "tom"
2、可以用json_unquote()去掉引号
例如:
select json_unquote(json_extract(area_code,'$.name')) as age from dfcv_vps_plus_api_vehicle_monitor_terminalstatus where chassis_new ='N9002199'
结果: tom (去掉了双引号)
3、如果是json数组,
A->'$.B'->'$.C'这样的方式就不行了,反正我试了就是取不到,报语法错误,可以用下面这种方式
json_extract(json_extract(A,'$.B'),'$.C')
在用 json_unquote去掉引号