How to write and get a JSON file in Google Cloud Storage Bucket?

Anurag Bhatt
Analytics Vidhya
Published in
Feb 1, 2020
Photo by Daniel Páscoa on Unsplash

We will create two functions which will upload and create a JSON file in Cloud Storage Bucket you can then use those function in flask, fastAPI, etc.

# libraries used
google-cloud-storage==1.40.0

Function 1 : In this function we will create json object and upload it to cloud storage bucket.

create json object in google cloud storage bucket

Function 2 : In this function we will download the given json object from cloud storage bucket.

download json object from google cloud storage bucket

I have commented the code for your understanding if you are not able to understand some lines write your response on article I will get back at you.

--

--