Why this not working ?
Our SQL table.
A MySQL-query that returns JSON.
I found this here Mysql to Json
Thanks
Our SQL table.
Code:
username email tommy tommy@example.com jane jane@example.com jack jack@example.com
Code:
SELECT
CONCAT("[",
GROUP_CONCAT(
CONCAT("{username:'",username,"'"),
CONCAT(",email:'",email),"'}")
)
,"]")
AS json FROM users;
Code:
[
{username:'tommy',email:'tommy@example.com'},
{username:'jane',email:'jane@example.com'},
{username:'jack',email:'jack@example.com'}
]
Thanks
Comment