Hello @Yididiya Samuel ,
If the blob is of type "Appendblob" , then we can update the content.
Below is the C#.net code
public static void AppendUsersToExistingJsonInBlobStorage()
{
string connection = "DefaultEndpointsProtocol=https;AccountName=storageaccountname;AccountKey=key=;EndpointSuffix=core.windows.net";
string filename = "users.json";
string containerstring = "users";
CloudStorageAccount storage = CloudStorageAccount.Parse(connection);
CloudBlobClient client = storage.CreateCloudBlobClient();
CloudBlobContainer container = client.GetContainerReference(containerstring);
CloudAppendBlob blob = container.GetAppendBlobReference(filename);
using (MemoryStream stream = new MemoryStream())
using (StreamWriter sw = new StreamWriter(stream))
{
sw.WriteLine("user3");
sw.Flush();
stream.Position = 0;
blob.AppendFromStream(stream);
}
}
Please note: Above code might not maintain the JSON formatting after adding/updating the blob , so please modify accordingly based upon your requirements
Regards,
Shiva.