Amazon web services 如何从AWS API网关的响应中删除JSON模式?

Amazon web services 如何从AWS API网关的响应中删除JSON模式?,amazon-web-services,vuejs2,aws-api-gateway,Amazon Web Services,Vuejs2,Aws Api Gateway,根据以下文档,我使用AWS API网关作为DynamoDb的代理: 在API网关中测试时,结果如下: { "Count": 6, "Items": [ { "mini_description": { "S": "A veg sandwich" }, "item_description": { "S": "A veg sandwich filled with a lot of healthy vegetables

根据以下文档,我使用AWS API网关作为DynamoDb的代理:

在API网关中测试时,结果如下:

{
  "Count": 6,
  "Items": [
    {
      "mini_description": {
        "S": "A veg sandwich"
      },
      "item_description": {
        "S": "A veg sandwich filled with a lot of healthy vegetables"
      },
      "id": {
        "S": "6d0e0870-......-c5ccfbc0424c"
      },
      "image_url": {
        "S": "https://......png"
      },
      "price": {
        "N": "25"
      },
      "name": {
        "S": "Veg Sandwich"
      },
      "item_type": {
        "S": "Main Dish"
      }
    },
    {
      "mini_description": {
        "S": "A normal hot coffee"
      },.....
我需要以下格式的文件:

{
  "Count": 6,
  "Items": [
    {
      "mini_description": "A veg sandwich",
      "item_description": "A veg sandwich filled with a lot of healthy vegetables",
      "id": "6d0e0870-.......-c5ccfbc0424c",
      "image_url": "https://.......png",
      "price": 25,
      "name": "Veg Sandwich",
      "item_type": "Main Dish"
    },
    {
      "mini_description": "A normal hot coffee",............

是否有任何程序可以通过API网关的集成响应来更改此设置?

如果API网关直接连接到DynamoDB,则无法解组数据。但是,您可以在API网关和DynamoDB之间添加Lambda函数,然后使用(或任何其他首选语言)删除DynamoDB JSON元素。

我通过在API网关中的GET方法的集成响应中使用以下映射模板实现了这一点:

#set($inputRoot = $input.path('$'))
{
  "Items": [
#foreach($elem in $inputRoot.Items)
    {
      "mini_description" : "$elem.mini_description.S",
      "item_description" : "$elem.item_description.S",
      "id" : "$elem.id.S",
      "image_url" : "$elem.image_url.S",
      "price" : $elem.price.N,
      "name" : "$elem.name.S",
      "item_type" : "$elem.item_type.S"
    }#if($foreach.hasNext),#end

#end
  ]
}