select * from cars WHERE JSON_EXTRACT(data, "$.color") = 'red';
select * from cars ORDER BY JSON_EXTRACT(data, "$.color") DESC;
tuning_color - GridView column class
info - table name
data - JSON column name
color - parameter to sort
info.data:
{"color":"red"}
$dataProvider->sort->attributes['tuning_color'] = [
'asc' => ["JSON_EXTRACT(info.data, '$.color')" => SORT_ASC],
'desc' => ["JSON_EXTRACT(info.data, '$.color')" => SORT_DESC],
];
->andFilterWhere([
'=',
"JSON_EXTRACT(info.data, '$.color')",
(int) $this->tuning_color ?: $this->tuning_color
])