I have a lambda func that gets values from my DynamoDB table. The String values are printed to my cloud watch logs but look like this {'S': 'Random String here'} . How can I just get the string by itself. I understand that the S represents the attribute value for string https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValue.html .
Lambda Code:
import json
import boto3
from boto3.dynamodb.conditions import Key, Attr
def lambda_handler(event, context):
e = event['Records'][0]
message = e['dynamodb']['NewImage']['latestMessage']
print(message) # This prints {'S': 'Random message here'}
How can I get the string without the {'S': ' '}
print(message['S'])?