1回答
- 新しい順
- 投票が多い順
- コメントが多い順
0
This is kinda hacky, but you need to work in strings a little further as once you are in json objects there doesn't seem a way to re-stringiify... Here is my snippet...
{ "StreamName": "event-stream-qa", "Records": [
#set($datakey = ".data")
#set($partitionkey = ".key")
#foreach($elem in $input.path('$.records'))
#set($pathBegin = "$.records[")
#set($pathEnd = "]")
#set($currentIndex = $foreach.index)
#set($dataPath = "$pathBegin$currentIndex$pathEnd$datakey")
#set($partitionPath = "$pathBegin$currentIndex$pathEnd$partitionkey")
#set($dataJson = $input.json($dataPath))
#set($partitionJson = $input.json($partitionPath))
{
"Data": "$util.base64Encode($dataJson)",
"PartitionKey": $partitionJson
}
#if($foreach.hasNext),#end
#end
]
}
回答済み 1年前
関連するコンテンツ
- AWS公式更新しました 10ヶ月前
- AWS公式更新しました 2年前