How to simplify aws DynamoDB query JSON output from the command line?

前端 未结 5 565
暖寄归人
暖寄归人 2020-12-25 15:14

I\'m working with The AWS Command Line Interface for DynamoDB.

When we query an item, we get a very detailed JSON output. You get something like this (it has been bu

5条回答
  •  执笔经年
    2020-12-25 15:30

    Another way to achieve the post's goal would be to use a node.js extension like node-dynamodb or dynamodb-marshaler and build a node command line tool.

    Interesting tutorial to build a node.js command line application with commander package: Creating Your First Node.js Command-line Application


    Here's a quick and dirty oneliner that reads one record from stdin and prints it in simplified form:

    node -e 'console.log(JSON.stringify(require("aws-sdk").DynamoDB.Converter.unmarshall(JSON.parse(require("fs").readFileSync(0, "utf-8")))))'
    

提交回复
热议问题