mysql5.7中 json函数


官方文档:json相关函数

https://dev.mysql.com/doc/refman/5.7/en/json-creation-functions.html

json数组,数组元素是对象

# 表字段名:  templates
# json内容: [{"expression": "true", "id": 2}]

SELECT * FROM t_rule WHERE json_contains(templates, json_object('id', 1)) ; SELECT * FROM t_rule WHERE json_contains(templates, json_object('expression', 'true')) ;