Available from version 11.2, this function compares two JSON arrays and returns a new array containing only the items present in both.
SET @json1= '[1,2,3]';
SET @json2= '[1,2,4]';
SELECT json_array_intersect(@json1, @json2);
+--------------------------------------+
| json_array_intersect(@json1, @json2) |
+--------------------------------------+
| [1, 2] |
+--------------------------------------+