Logic Apps Best Practices, Tips, and Tricks: #53 Properly Creating an Empty String Variable

  • Sandro Pereira
  • Jul 14, 2026
  • 3 min read

Welcome again to another Logic Apps Best Practices, Tips, and Tricks post. In my previous articles, I covered several essential best practices for working with Azure Logic Apps. If you missed them, be sure to explore these Logic Apps tips and tricks.

The challenge

Creating an empty string variable in Azure Logic Apps appears to be a simple task. However, many developers come to Logic Apps with a traditional programming background, especially in languages like C#.

When creating an empty string in C#, it is common to use one of the following approaches:

string customerName = "";

or

string customerName = string.Empty;

Both statements create a valid string with zero characters.

Because of this, many developers naturally expect the same concept to apply when creating a String variable in Logic Apps.

However, is the following configuration really equivalent to string.Empty in C#?

How to create an empty string variable

📝 One-Minute Brief

Many developers transitioning from traditional programming languages such as C# assume that setting a Logic Apps string variable to “” is equivalent to creating an empty string. However, Logic Apps interprets this value differently, potentially leading to unexpected results in payloads, tracking properties, conditions, and downstream integrations. This post explains the correct way to initialize an empty string variable in Logic Apps, highlights common mistakes, and demonstrates how seemingly small configuration choices can impact workflow behavior and troubleshooting.

How to Properly Creating an Empty String Variable inside Logic Apps

Understanding how Logic Apps handles empty strings variable initialization can help you avoid unexpected runtime behavior and make your workflows more predictable and easier to maintain.

Maybe it is beacause many Logic Apps developers come from traditional programming background, especially in languages like C#, maybe not, but the reality is that many yound Logic Apps developers often assume the same approach should be used when initializing a String variable in Logic Apps and set the value to: “” (using double quotation marks)

Empty string initialization

However, is this really the correct way?

The short answer is no.

In Logic Apps, the correct way to initialize an empty String variable is simply to leave the Value field empty:

This may be a shocking surprise to discover that leaving the Value field blank when initializing a string variable actually produces the expected result.

Still question if this is true? Let’s see it in action.

For that we have:

  • Created a simple Workflow that initialize two variables, one with double quotes and one leaving the value empty.
Initialize variables
  • Then we add a Response action with the following Body as response
{
  "EmptyWithQuotes": "this is:@{variables('varStringEmpty')}",
  "Empty": "this is: @{variables('varStringEmptyCorrect')}"
}
  • If now we test the workflow we will see the result confirming that Logic Apps interprets this differently than C#. Instead of creating an empty string, it creates a string containing two quotation mark characters.
{
  "EmptyWithQuotes": "this is:\"\"",
  "Empty": "this is:"
}

The result is:

  • EmptyWithQuotes contains two actual quote characters ("").
  • Empty contains nothing after the colon, representing a truly empty string.
Correct way

This subtle difference can lead to unexpected behaviour when composing messages, creating JSON payloads, building tracking properties, or sending data to downstream systems.

I hope you find this helpful! If you liked the content or found it useful and want to help me write more, you can consider buying (or helping to buy) my son a Star Wars Lego set. 

Buy me a coffee
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top