I'm using AWS Lambda to scan data from a DynamoDB table. This is what I get in return:

{
  "videos": [
    {
      "file": {
        "S": "file1.mp4"
      },
      "id": {
        "S": "1"
      },
      "canvas": {
        "S": "This is Canvas1"
      }
    },
    {
      "file": {
        "S": "main.mp4"
      },
      "id": {
        "S": "0"
      },
      "canvas": {
        "S": "this is a canvas"
      }
    }
  ]
}

My front-end application is using Ember Data Rest Adapter which does not accepts such response. Is there any way I can get normal JSON format? There is this NPM module called dynamodb-marshaler to convert DynamoDB data to normal JSON. I'm looking for a native solution if possible.

推荐答案

AWS JavaScript SDK was recently updated with Document Client which does exactly what you need. Check the announce and usage examples here: http://blogs.aws.amazon.com/javascript/post/Tx1OVH5LUZAFC6T/Announcing-the-Amazon-DynamoDB-Document-Client-in-the-AWS-SDK-for-JavaScript

Json相关问答推荐

JSON:将项';S键/名称移动到属性中,并使用JQ将其转换为数组

当有2个嵌套数组时展平复杂的JSON

如何在我的响应模型中修复此问题:[期望的值类型为';Map<;Dynamic,Dynamic&>;,但获得的值类型为';NULL&39;]

如何从一个700MB的json文件中列出PowerShell中的所有密钥?

报告重复的对象键

在Databricks中如何将JSON文件作为字典读取

小写嵌套特定键的震动转换

如何迭代、动态加载我的表单输入元素,然后在 React 中的表单提交上检索输入值?

Powershell - 如何从 JSON 中删除/过滤元素但保留其余部分?

使用 Ansible 解析来自 Juniper 交换机的 JSON 输出

一起使用 Argparse 和 Json

如何一次加载无限滚动中的所有条目以解析python中的HTML

如何为名称/值 struct 创建 JSON 模式?

IE中Json响应下载(7~10)

如何使用 Jackson 重命名 JSON 序列化中的根键

如何在 json 编码字符串内的子数组数据周围添加方括号?

在 Java 中比较两个 JSON 文件的最佳方法

字符串格式 JSON 字符串给出 KeyError

IE10/11 Ajax XHR 错误 - SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3

如何在dart Flutter 中将json字符串转换为json对象?