3/15/2023

load json file in memory form s3 bucket object (python example code)

 refer to code:

.

import boto3
import json

# Initialize the S3 client
s3 = boto3.client('s3')

# Specify the S3 bucket and JSON file key
bucket_name = 'your-bucket-name'
file_key = 'path/to/your/file.json'

# Download the JSON file from the S3 bucket
response = s3.get_object(Bucket=bucket_name, Key=file_key)
content = response['Body'].read()

# Parse the JSON content
data = json.loads(content)

# Print the JSON data
print(data)

..


Thank you.

๐Ÿ™‡๐Ÿป‍♂️

www.marearts.com

No comments:

Post a Comment