将 MySql table 导出到 JSON 对象
Exporting MySql table into JSON Object
如何将我的 mysql table 结果转换为数据库级别的 json 对象
例如,
SELECT json_array(
group_concat(json_object( name, email))
FROM ....
它将产生结果
[
{
"name": "something",
"email": "someone@somewhere.net"
},
{
"name": "someone",
"email": "something@someplace.com"
}
]
但我需要的是我需要给出我自己的查询,其中可能包含函数、子查询等
就像在 postgres 中一样 select row_to_json(select name,email,getcode(branch) from .....)
然后我将得到整个结果作为 json object
在mysql中有没有可能这样做?
select jsonArray(select name,email,getcode(branch) from .....)
如何将我的 mysql table 结果转换为数据库级别的 json 对象
例如,
SELECT json_array(
group_concat(json_object( name, email))
FROM ....
它将产生结果
[
{
"name": "something",
"email": "someone@somewhere.net"
},
{
"name": "someone",
"email": "something@someplace.com"
}
]
但我需要的是我需要给出我自己的查询,其中可能包含函数、子查询等
就像在 postgres 中一样 select row_to_json(select name,email,getcode(branch) from .....)
然后我将得到整个结果作为 json object
在mysql中有没有可能这样做?
select jsonArray(select name,email,getcode(branch) from .....)