How create json format with group-concat mysql?

With the newer versions of MySQL, you can use JSON_OBJECT function to achieve the desired result, like so: GROUP_CONCAT( JSON_OBJECT( ‘name’, name, ‘phone’, phone ) ) AS list To get the SQL response ready to be parsed as an array: CONCAT( ‘[‘, GROUP_CONCAT( JSON_OBJECT( ‘name’, name, ‘phone’, phone ) ), ‘]’ ) AS list This … Read more