I am having trouble using the client.put_item method to put a list of dicts to my table. The dict is in the form: {"name": "beef", "price":5.23}. An example of a list like this is: [{"name": "chicken", "price":6.23}, {"name": "beef", "price":5.34}, {"name": "pork", "price":8.48}] where the list size could vary. So far I have
def create_order(order_id, cart, total):
dynamodb = boto3.client('dynamodb')
table = 'Orders'
response = dynamodb.put_item(TableName=table,
Item={
'order_id': {"S":order_id},
'order_total': {"N":str(total)},
'cart':{"L":cart}
}
)
return response
It works with order_id and order_total, but I can't figure out how to format the cart.