JSONデータをRedshiftに読み込む作業をしていますが、動作させるにはオブジェクト間でコンマを削除する必要があります。カンマを削除しても正常に動作します。JSONアレイ内のオブジェクト間のコンマを削除する
Redshiftに読み込むことができるようにオブジェクト間のカンマを削除する方法を教えてもらえますか?
Redshift copyコマンドでは、オブジェクトの配列だけを行としてロードできます。
現在、私はこのJSONを持っている:
[{
"id":"57e4d12e53a5a",
"body":"asdas",
"published":"Fri,
23 Sep 2016 06:52:30 +0000",
"type":"chat-message",
"actor":
{
"displayName":"beau",
"objectType":"person",
"image":
{
"url":"http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=80&d=mm&r=g",
"width":48,"height":48
}
}
},
{
"id":"57e4d51165d97",
"body":"jackiechanSADAS",
"published":"Fri, 23 Sep 2016 07:09:05 +0000",
"type":"chat-message",
"actor":
{
"displayName":"beau",
"objectType":"person",
"image":
{
"url":"http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=80&d=mm&r=g",
"width":48,
"height":48
}
}
},
{
"id":"asas",
"body":"peterting",
"published":"Fri, 23 Sep 2016 07:09:05 +0000",
"type":"chat-message",
"actor":
{
"displayName":"beau",
"objectType":"person",
"image":
{
"url":"http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=80&d=mm&r=g",
"width":48,
"height":48
}
}
}]
私はこれにそれを変換する必要があります。
{
"id":"57e4d12e53a5a",
"body":"asdas",
"published":"Fri,
23 Sep 2016 06:52:30 +0000",
"type":"chat-message",
"actor":
{
"displayName":"beau",
"objectType":"person",
"image":
{
"url":"http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=80&d=mm&r=g",
"width":48,"height":48
}
}
}
{
"id":"57e4d51165d97",
"body":"jackiechanSADAS",
"published":"Fri, 23 Sep 2016 07:09:05 +0000",
"type":"chat-message",
"actor":
{
"displayName":"beau",
"objectType":"person",
"image":
{
"url":"http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=80&d=mm&r=g",
"width":48,
"height":48
}
}
}
{
"id":"asas",
"body":"peterting",
"published":"Fri, 23 Sep 2016 07:09:05 +0000",
"type":"chat-message",
"actor":
{
"displayName":"beau",
"objectType":"person",
"image":
{
"url":"http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=80&d=mm&r=g",
"width":48,
"height":48
}
}
}
カンマが必要objects'の '配列。問題はおそらく他にあります。 –
同様の問題 がありましたが、反対方向です。ここをクリックしてください:https://stackoverflow.com/questions/38695977/convert-json-object-containing-objects-into-an-array-of-objects – Arkadiusz
[documentation](http://docs.aws。 amazon.com/redshift/latest/dg/copy-usage_notes-copy-from-json.html)あなたの期待される出力は正しいようですが、それは 'Array of Objects'ではありません。 –