aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.38k stars 4.09k forks source link

aws dynamodb get-item toggle "View DynamoDB JSON" #6681

Open kaihendry opened 2 years ago

kaihendry commented 2 years ago

Is your feature request related to a problem? Please describe.

image

Describe the solution you'd like A JSON output switch aws dynamodb get-item help

Describe alternatives you've considered

I'm not sure how to transform something like:

{
 "id": {
  "S": "210.23.22.2"
 },
 "created": {
  "N": "1643333754"
 },
 "expires": {
  "N": "1643333814"
 },
 "color": {
  "S": "#cc0000"
 }
}

into

{
 "id": "210.23.22.2",
 "created": 1643333754,
 "expires": 1643333814,
 "color": "#cc0000"
}

with something like jq, but it must be possible?

kdaily commented 2 years ago

Hi @kaihendry, thanks for the feature request. There are a number of edge cases for serializing and deserializing DynamoDB JSON. boto3 has classes for serializing and deserializing:

https://github.com/boto/boto3/blob/develop/boto3/dynamodb/types.py