1. {["name":"name1"]};
2. {["name":"name2", "name1"]};
3. {["name":"name1"]};
SELECT DISTINCT features->"$.name" FROM data
DELIMITER $$
DROP PROCEDURE IF EXISTS extract_params;
CREATE PROCEDURE extract_params()
BEGIN
DECLARE exit_flag INT DEFAULT 0;
DECLARE j JSON;
DECLARE i INT;
DECLARE q VARCHAR(255);
DECLARE t VARCHAR(255);
DECLARE c CURSOR FOR
SELECT CAST(jdoc->'$."name"' AS JSON) FROM t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET exit_flag = 1;
DROP TEMPORARY TABLE IF EXISTS tmp_123;
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_123 (jsn VARCHAR(255)) ENGINE=MEMORY;
OPEN c;
fetch_loop: LOOP
FETCH c INTO j;
IF exit_flag THEN LEAVE fetch_loop; END IF;
IF JSON_TYPE(j) = 'ARRAY' THEN
SET i = JSON_LENGTH(j);
WHILE i > 0 DO
SET i = i - 1;
SET q = CONCAT('$[',i,']');
SET t = JSON_UNQUOTE(JSON_EXTRACT(j, q));
INSERT INTO tmp_123 VALUES(t);
END WHILE;
END IF;
END LOOP;
CLOSE c;
SELECT DISTINCT(jsn) FROM tmp_123;
END$$