我正在尝试找出导致这种JSON格式的SQL查询是什么:
{
"body": {
"environments": {
"lapilops": {
"api_url": "1",
"dlc_url": "1",
"dlc_ver": "1,
"site_url": "1",
"photon_url": "1",
"logcollection_url": "1",
"env_name": "greatness"
}
}
}
}
我有一个名为lapilops的表,并且所有列都包括在内。我的SQL查询是:
select *
from lapilops
where
Ticket = "1" AND
version = "1" AND
ios = "adr";
当我将结果复制/转换为JSON格式时,它变为:
{
"data":
[
{
"Ticket": 1,
"version": "1",
"os": "adr",
"api_url": "1",
"dlc_url": "1",
"dlc_ver": "1",
"site_url": "1",
"photon_url": "1",
"logcollection_url": "1",
"env_name": "greatness"
}
]
}
我需要添加一个名为“ environments”和“ body”的表吗?
我正在运行SQL查询并在Sequel Pro中复制查询结果。
答案 0 :(得分:0)
您将要使用JSON_OBJECT进行很多操作,如果要在SQL中进行操作,这将看起来并不漂亮。您能否将其读入应用程序并使用一些库将数据序列化为JSON格式?