【发布时间】:2018-05-01 11:30:06
【问题描述】:
我有以下 JSON 格式的行:
[
{
"id": 1,
"costs": [
{
"blue": 100,
"location":"courts",
"sport": "football"
}
]
}
]
我想把它上传到一个红移表中,如下所示:
id | blue | location | sport
--------+------+---------+------
1 | 100 | courts |football
以下 JSONPaths 文件不成功:
{
"jsonpaths": [
"$.id",
"$.costs[0].blue",
"$.costs[0].location",
"$.costs[0].sport"
]
}
Redshift 返回以下错误代码:
err_code: 1216 Invalid JSONPath format: Member is not an object.
如何更改 jsonpaths 文件以便能够根据需要上传 json?
【问题讨论】:
-
我认为这可能是因为您的表达式未包含在
{}中,因此它不是有效的 JSON。 -
感谢@JohnRotenstein。在我删除环绕行的 [] 后它起作用了。祝你有美好的一天!
标签: json amazon-redshift