需求:
select jsonArray[index],index from table;
错误示范
select jsonArray->"$[index]",index from table;
select json_extract(jsonArray, "$[index]"),index from table;
原理&正确方法
可以用字符串拼接函数 CONCAT 生成json_extract 的第二个参数
select json_extract(jsonArray,CONCAT('$[',`index`,']')),index from table;