Reading a JSON File
Learn how to read a JSON file stored in a Filebase bucket using Python & Boto3.
What is JSON?
1. Create a file called json_read.py with the following contents:
json_read.py with the following contents:import boto3
import json
from botocore.config import Config
boto_config = Config(region_name = 'us-east-1',
signature_version = 's3v4')
s3 = boto3.client('s3',
endpoint_url = 'https://s3.filebase.com',
aws_access_key_id='filebase-access-key',
aws_secret_access_key='filebase-secret-key',
config=boto_config)
object = s3.get_object(Bucket='filebase-sample-bucket',Key='my_file.json')
j = json.loads(object['Body'].read())
print(j['Details'])2. Replace the following values:
3. Run the Python script to return the requested JSON property content.
Last updated