0

I couldn't convert csv to json format Here is my code that I have been trying:

import boto3
import csv
import json
s3 = boto3.resource('s3')
s3_client = boto3.client('s3')
my_bucket = s3.Bucket('bucket_name')

def lambda_handler(event, context):    
    result = s3_client.get_object(Bucket=my_bucket, Key='Untitled1.csv')     
    text = result["Body"].read().decode("utf-8")
    output = json.dumps([[ row for row in text ]])
    print(output)
return text 
raviraju
  • 23
  • 1
  • 1
  • 7

0 Answers0