json解析函数

palo目前支持3个json解析函数

  • get_json_int(string,string)

  • get_json_string(string,string)

  • get_json_double(string,string)

其中第一个参数为json字符串,第二个参数为json内的路径

举例:

  1. mysql> select get_json_int('{"col1":100, "col2":"string", "col3":1.5}', "$.col1");
  2. +---------------------------------------------------------------------+
  3. | get_json_int('{"col1":100, "col2":"string", "col3":1.5}', '$.col1') |
  4. +---------------------------------------------------------------------+
  5. | 100 |
  6. +---------------------------------------------------------------------+
  7. 1 row in set (0.01 sec)
  1. mysql> select get_json_string('{"col1":100, "col2":"string", "col3":1.5}', "$.col2");
  2. +------------------------------------------------------------------------+
  3. | get_json_string('{"col1":100, "col2":"string", "col3":1.5}', '$.col2') |
  4. +------------------------------------------------------------------------+
  5. | string |
  6. +------------------------------------------------------------------------+
  7. 1 row in set (0.01 sec)
  1. mysql> select get_json_double('{"col1":100, "col2":"string", "col3":1.5}', "$.col3");
  2. +------------------------------------------------------------------------+
  3. | get_json_double('{"col1":100, "col2":"string", "col3":1.5}', '$.col3') |
  4. +------------------------------------------------------------------------+
  5. | 1.5 |
  6. +------------------------------------------------------------------------+
  7. 1 row in set (0.01 sec)