I'm trying to read a .json
file as dict()
in a python code from VM instance stored in google cloud storage bucket.
I tried reading json file as blob:
client = storage.Client()
bucket = client.get_bucket('bucket-id-here')
blob = bucket.get_blob('remote/path/to/file.json')
str_json = blob.download_as_string()
But I'm unable to decode the str_json
. Is my approach correct? if any other approach available please let me know.
I need something like:
# Method to load json
dict = load_json(gcs_path='gs://bucket_name/filename.json')