【发布时间】:2014-05-10 06:50:25
【问题描述】:
例如,我从一个 URL 获得了以下 JSON
{ "time": "2014-05-10 06:23:36 UTC",
"values": [
{
"time_timetable_utc": "2014-05-10T06:25:00Z",
"time_realtime_utc": null,
"flags": ""
},
{
"time_timetable_utc": "2014-05-10T06:45:00Z",
"time_realtime_utc": null,
"flags": ""
},
]
}
这将适用于 YQL
select time from json where url="{url}"
它只会返回时间字段
{"time": "2014-05-10 06:23:36 UTC"}
但如果我只想通过以下方式获取“值”数组字段
select values from json where url="{url}"
我会收到此错误消息
Query syntax error(s) [line 1:7 expecting fields_or_star got 'values']
只是想问一下是否可以选择名称为保留的 Yahoo YQL 关键字的 JSON 字段?
我知道这会奏效
select * from json where url="{url}" and itemPath="json.values"
但是不使用“itemPath”条件是否可以做到这一点?
如何在 YQL 选择中转义保留字如“值”?
【问题讨论】:
-
有什么理由不想使用 itemPath?
标签: json select field yql yahoo-api