【发布时间】:2019-07-04 01:34:17
【问题描述】:
我正在尝试将 json 文件导入 PostgreSQL。 示例数据:
{
"asin":"2094869245",
"title":"5 LED Bicycle Rear Tail Red Bike Torch Laser Beam Lamp Light",
"price":8.26,
"imhUrl":"http://ecx.images-amazon.com/images/I/51RtwnJwtBL._SY300_.jpg"
}
{
"asin":"7245456259",
"title":"Black Mountain Products Single Resistance Band - Door Anchor,
"price":10.49,
"imhUrl":"http://ecx.images-amazon.com/images/I/411Ikpf122L._SY300_.jpg"
}`
希望结果看起来像:
data
--------------------------------------------------------------------
{
"asin":"2094869245",
"title":"5 LED Bicycle Rear Tail Red Bike Torch Laser Beam Lamp Light",
"price":8.26,
"imhUrl":"http://ecx.images-amazon.com/images/I/51RtwnJwtBL._SY300_.jpg"
}
--------------------------------------------------------------------
{
"asin":"7245456259",
"title":"Black Mountain Products Single Resistance Band - Door Anchor,
"price":10.49,
"imhUrl":"http://ecx.images-amazon.com/images/I/411Ikpf122L._SY300_.jpg"
}
数据是json类型。
我的 JSON 文件将存储在一个名为 data 的 JSON 列中。
【问题讨论】:
-
所以文件包含无效的 JSON,您想将其拆分为有效的 JSON 值吗?
-
否。我的 json 文件有效,我想将他导入 postgres 的单个 json 列中。
-
您的第一个示例是无效的 JSON 值。那应该是两个文件还是一个文件?如果是一个文件,那么各个对象是如何分开的?
-
那么您的示例在值之间缺少
,- 如图所示,此 is 无效 JSON。
标签: json postgresql