Your IN() query might not work correctly because mysql return '1,2' for id 1, and you need something like 1,2, Check following example
select
replace(replace(t1.ids,'[',''),']','') as id
from table11 t1 where t1.id=1;
Above query return result as string which interpret like '1,2' not 1,2
And because of this your query might not return your expected output.
You can try some other approach, as follow
SOLUTION
Create 1 function which will convert your json string to another table and then you can use that table into your in() query
Try following function (Reference)
DROP FUNCTION IF EXISTS hello;
DELIMITER //
CREATE FUNCTION hello (_list CHAR(20))
RETURNS INT
BEGIN
DECLARE _next TEXT DEFAULT NULL;
DECLARE _nextlen INT DEFAULT NULL;
DECLARE _value TEXT DEFAULT NULL;
iterator:
LOOP
IF LENGTH(TRIM(_list)) = 0 OR _list IS NULL THEN
LEAVE iterator;
END IF;
SET _next = SUBSTRING_INDEX(_list,',',1);
SET _nextlen = LENGTH(_next);
SET _value = TRIM(_next);
INSERT INTO t11 (id) VALUES (_next);
SET _list = INSERT(_list,1,_nextlen + 1,'');
END LOOP;
RETURN 1;
END //
DELIMITER ;
Create one table
CREATE TABLE t11(id CHAR(1));
Then execute following queries.
DELETE FROM t11;
SELECT hello(REPLACE(REPLACE(t1.ids,'[',''),']','')) FROM table11 t1;
SELECT t2.* FROM table22 t2 WHERE t2.id IN(SELECT id FROM t11);
I hope this will solve your problem