Mysql获取json字符串/数组的值
一、单个json的,获取值使用json_extract`select json_extract('{"name":"Zhaim","tel":"13240133388"}',"$.tel`");二、数组的json的,获取数组的长度使用JSON_LENGTHSELECT id,JSON_LENGTH('[{"id":"10000004555096","name":"1.docx"},{"id":"1
·
一、单个json的,获取值使用json_extract
`select json_extract('{"name":"Zhaim","tel":"13240133388"}',"$.tel`");
二、数组的json的,获取数组的长度使用JSON_LENGTH
SELECT id,JSON_LENGTH('[{"id":"10000004555096","name":"1.docx"},{"id":"10000004555098","name":"2.doc"},{"id":"10000004555097","name":"3.html"}]'),F_zwm,F_dhhm FROM `w_b01rzcllc` limit 10;
三、数组的json的,获取数组的值使用json_extract
SELECT id,json_extract('[{"id":"10000004555096","name":"1.docx"},{"id":"10000004555098","name":"2.doc"},{"id":"10000004555097","name":"3.html"}]',"$[0].name"),F_zwm,F_dhhm FROM `w_b01rzcllc` limit 10;
更多推荐
已为社区贡献3条内容
所有评论(0)