I have written below Json for insert in dynamodb, but unable to insert. But if I try single element without array it's working fine.
$item = $marshaler->marshalJson('
[
{
"PK":"CATG",
"SK":"NAME#SMART_PHONE",
"TYPE":"CATG",
"ATTR":{
"name":"安いスマートフォン一覧【最安値比較】"
}
},
{
"PK":"CATG#SMART_PHONE",
"SK":"SUBCATG#IPHONE",
"TYPE":"SUBCATG",
"ATTR":{
"name":"IPHONE",
"Compa":"mac",
"uid":123
}
},
{
"PK":"CATG#SMART_PHONE#SUBCATG#IPHONE",
"SK":"PROD#PHONE11",
"TYPE":"PROD",
"ATTR":{
"name":"PHONE11",
"uid":123,
"price":112.02,
"images":[
],
"total":120
}
},
{
"PK":"CATG#SMART_PHONE#SUBCATG#IPHONE",
"SK":"PROD#PHONE7",
"TYPE":"PROD",
"ATTR":{
"name":"PHONE7",
"Compa":"mac",
"uid":124,
"price":102.02,
"images":[
],
"total":80
}
}
]
');
$params = [
'TableName' => $tableName,
'Item' => $item
];
$result = $dynamodb->putItem($params);
After apply this code.
I have got below error
Fatal error: Uncaught InvalidArgumentException: The JSON document must be valid and be an object at its root. in E:xampphtdocsshopvendorawsaws-sdk-phpsrcDynamoDbMarshaler.php:99 Stack trace: #0 E:xampphtdocsshopitem.php(30): AwsDynamoDbMarshaler->marshalJson('
[
...') #1 {main} thrown in E:xampphtdocsshopvendorawsaws-sdk-phpsrcDynamoDbMarshaler.php on line 99
If I insert single row it's working fine. How can I insert bulk row ?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…