Is there a way to upload a json file to an azure blob without saving the json data to a local file?

I am making a python based webapp that uses jsons to store information for different accounts. I am not able to temporarily save the json data to a local file and then upload it to a blob. Is there a way to remove that step and just upload the json data directley as a file in a blob?

This is how you normally upload a file

with open(upload_file_path, "rb") as data:
    blob_client.upload_blob(data)

Is there something like blob_client.upload_blob(<json object>) that works?

🔴 No definitive solution yet

📌 Solution 1

Is there something like blob_client.upload_blob(<json object>) that works?

Yes. If you look at the documentation for upload_blob, you will notice that the data parameter can be of AnyStr, Iterable or IO type.

What you could do is serialize the JSON object as string using json.dumps() and pass that as data to the upload_blob method.