If you want to get a JSON file from an S3 Bucket and load it into a Python Dictionary then you can use the example codes below.
There are 4 scenarios for the examples scripts below.
- Basic JSON file from S3 to Python Dictionary
- With Try/Except block
- With datetime, date, and time conversions
- Running the code in a Lambda Function
AWS boto3 provides 2 ways to access S3 files, the boto3.client('s3')
and boto3.resource('s3')
. For each of the example scenarios above, a code will be provided for the two methods.
Related: Writing a Dictionary to JSON file in S3 using boto3 and Python
Since both methods will function the same, you can choose whichever method you like.
Continue reading How to read a JSON file in S3 and store it in a Dictionary using boto3 and Python