Convert table to JSON array with longtext column Convert table to JSON array with longtext column json json

Convert table to JSON array with longtext column


Just JSON_COMPACT function, which's proper to MariaDB and does not exists in MySQL, might be applied for the parameters column

SELECT CONCAT(       '[',        GROUP_CONCAT(JSON_OBJECT('id',id,                                 'name',name,'parameters',                                   JSON_COMPACT(parameters))),       ']'       ) AS "JSON Value"  FROM user

Demo