最近用到了对 Mysql 中对 JSON 类型的字符串进行筛选,这边做个简单的总结:

添加筛查条件

1
select * from table_name where JSON_EXTRACT(JSON_String,'$.json字段名') = '' and ...

JSON 筛查加更新

1
2
update table_name set JSON_String = json_replace(JSON_String, '$.json字段名', 'jinmao')
where id in (?,?)
Edited on Views times