我越来越SerializationException在通过Dynamodb代理服务的API发布新唱片
"__type": "com.amazon.coral.service#SerializationException"
在API网关
测试控制台邮递员&回复尝试直接张贴记录使用API来dynamodb代理服务.. 我指的是这条AWS - https://aws.amazon.com/blogs/compute/using-amazon-api-gateway-as-a-proxy-for-dynamodb/
这里是我的映射
{
"TableName": "TableNameGoesHere",
"Item": {
"id" : "$context.requestId"
"eventName" : "$input.path('$.eventName')",
"timestamp" : $input.path('$.timestamp'),
"answers": "$util.parseJson($input.path('$.answers'))"
}
}
更新: 我按照要求......并且它的工作,但现在如果我尝试添加一个JSON对象数组,它给了我上述相同的错误 - 这是我现在要做的。请帮助 - 在Google上找不到任何东西
#set($inputRoot = $input.path('$'))
{
"TableName": "Answer",
"Item": {
"id": {
"S": "$context.requestId"
},
"eventName": {
"S": "$input.path('$.eventName')"
},
"timestamp" : {
"N": "$input.path('$.timestamp')"
},
"answers": {
"S": "$input.path('$.answers')"
},
"Line": {
"S" : "[
#foreach($elem in $inputRoot.Line)
{
"questionID" : "$elem.questionID",
"answer" : "$elem.answer"
}#if($foreach.hasNext),#end
#end
]" }
}
}
好的...我明白了......但是我想在数据库字段中添加一个Json对象 - 你能否在aws文档中提供一个参考。 –
它的工作,但我想添加一个Json对象的数组 - 为此我指的是http://docs.aws.amazon.com/apigateway/latest/developerguide/example-invoice.html#example-invoice - 输入映射,但我没有得到aws文档的API数据类型 –
@mac模具 看看我的回应低于 https://stackoverflow.com/a/44320439/1871718 –