我需要通过索引提取JSON元素,例如
SELECT JSON_EXTRACT('[{"featureId":"a","read":1,"write":1,"delete":1},{"featureId":"2","read":1,"write":0,"delete":1}]', '$[0].*');
但它只是提取我想要提取的部分的值如下:
{
"featureId": "a",
"read": 1,
"write": 1,
"delete": 1
}
答案 0 :(得分:0)
尝试:
SELECT JSON_EXTRACT('
[
{"featureId":"a","read":1,"write":1,"delete":1},
{"featureId":"2","read":1,"write":0,"delete":1}
]
', '$[0]');
请参阅db-fiddle。