Mysql获取json字符串/数组的值

单个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;

你可能感兴趣的:(Mysql获取json字符串/数组的值)