title: Add JSON string directly to Azure Blob Storage Container using C#
body: <p>I am trying to load a JSON string (serialized with Newtonsoft.Json) <strong>without creating a temporary file.</strong></p>
  
  <p>I am serializing object in runtime using JsonConvert.SerializeObject(obj,settings) which returns a string.</p>
  
  <p>Following Microsoft documentation I could do as it's illustrated below:</p>
  
  <pre><code>// Create a local file in the ./data/ directory for uploading and downloading
  string localPath = "./data/";
  string fileName = "quickstart" + Guid.NewGuid().ToString() + ".txt";
  string localFilePath = Path.Combine(localPath, fileName);
  
  // Write text to the file
  await File.WriteAllTextAsync(localFilePath, "Hello, World!");
  
  // Get a reference to a blob
  BlobClient blobClient = containerClient.GetBlobClient(fileName);
  
  Console.WriteLine("Uploading to Blob storage as blob:\n\t {0}\n", blobClient.Uri);
  
  // Open the file and upload its data
  using FileStream uploadFileStream = File.OpenRead(localFilePath);
  await blobClient.UploadAsync(uploadFileStream, true);
  uploadFileStream.Close();
  </code></pre>
  
  <p>Although it works, I would have to create temporary file for each uploaded JSON file.</p>
  
  <p>I tried this:</p>
  
  <pre><code>BlobServiceClient blobServiceClient = new BlobServiceClient("SECRET");
  
  BlobContainerClient container = BlobServiceClient.GetBlobContainerClient("CONTAINER_NAME");
  
  container.CreateIfNotExistsAsync().Wait();
  
  container.SetAccessPolicy(Azure.Storage.Blobs.Models.PublicAccessType.Blob);
  
  CloudBlockBlob cloudBlockBlob = new CloudBlockBlob(container.Uri);
  
  var jsonToUplaod = JsonConvert.SerializeObject(persons, settings);
  
  cloudBlockBlob.UploadTextAsync(jsonToUpload).Wait();
  </code></pre>
  
  <p>But, well...it doesn't have right to work as I am not specifing any actual file in the given container (I don't know where to do it).</p>
  
  <p><strong><em>Is there any way to upload a blob directly to a given container?</em></strong></p>
  
  <p>Thank You in advance.</p>