json解析函数
palo目前支持3个json解析函数
get_json_int(string,string)
get_json_string(string,string)
get_json_double(string,string)
其中第一个参数为json字符串,第二个参数为json内的路径
举例:
- mysql> select get_json_int('{"col1":100, "col2":"string", "col3":1.5}', "$.col1");
- +---------------------------------------------------------------------+
- | get_json_int('{"col1":100, "col2":"string", "col3":1.5}', '$.col1') |
- +---------------------------------------------------------------------+
- | 100 |
- +---------------------------------------------------------------------+
- 1 row in set (0.01 sec)
- mysql> select get_json_string('{"col1":100, "col2":"string", "col3":1.5}', "$.col2");
- +------------------------------------------------------------------------+
- | get_json_string('{"col1":100, "col2":"string", "col3":1.5}', '$.col2') |
- +------------------------------------------------------------------------+
- | string |
- +------------------------------------------------------------------------+
- 1 row in set (0.01 sec)
- mysql> select get_json_double('{"col1":100, "col2":"string", "col3":1.5}', "$.col3");
- +------------------------------------------------------------------------+
- | get_json_double('{"col1":100, "col2":"string", "col3":1.5}', '$.col3') |
- +------------------------------------------------------------------------+
- | 1.5 |
- +------------------------------------------------------------------------+
- 1 row in set (0.01 sec)