JSON_EXTRACT
取值为 string
的时候,会带上双引号 ",通常有两种方式可以去掉 MySQL JSON 结果的双引号。
JSON_EXTRACT
会有双引号 "mysql> SELECT JSON_EXTRACT(fld_Json, '$[0][1]') FROM tab_xxx; +-----------------------------------------------------+ | "CommandNotFound" | +-----------------------------------------------------+
mysql> SELECT fld_Json->>'$[0][1]' FROM tab_xxx; +---------------------------------------------------+ | CommandNotFound | +---------------------------------------------------+
JSON_UNQUOTE
mysql> SELECT JSON_UNQUOTE(JSON_EXTRACT(fld_Json, '$[0][1]')) FROM tab_xxx; +---------------------------------------------------+ | CommandNotFound | +---------------------------------------------------+