A few days ago, I worked with a client to develop a Project Management system utilizing SharePoint lists, libraries, and site pages.
The client requires JSON data for each project, and based on the project status, I want to update the Project priority value: replace ‘Low’ with ‘High’ if the status is ‘In Progress’.
In this tutorial, I will explain how to replace a string value in a JSON object using Power Automate, as well as how to replace null values in a JSON Object.
Example 1: Power Automate Replace String in JSON
Suppose I have a JSON Object with one project, as shown below, and I want to replace a string value, i.e., ‘Priority’, from ‘Low‘ to ‘High‘.
{
"ProjectID": "PRJ-2025-001",
"ProjectName": "Website Redesign",
"Client": "Acme Corp",
"StartDate": "2025-06-01",
"EndDate": "2025-08-15",
"Status": "In Progress",
"Priority": "Low"
}To do this, I will create an Instant cloud flow in Power Automate that will be triggered by clicking the button.
Check out the steps below:
- Sign in to Power Automate, click on + Create, and select Instant cloud flow. Provide the Flow name and choose the trigger flow (i.e., Manually trigger a flow), then click the Create button.
- Next, add a “Compose” action and insert the JSON object into the Inputs parameter.
Inputs: {
"ProjectID": "PRJ-2025-001",
"ProjectName": "Website Redesign",
"Client": "Acme Corp",
"StartDate": "2025-06-01",
"EndDate": "2025-08-15",
"Status": "In Progress",
"Priority": "Low"
}
- Then, I will add one more “Compose” action to replace the “Low” string with another string value, “High“.
- Inputs: Insert the expression given in the code below
json(replace(string(outputs('Compose')), 'Low', 'High'))
First, we need to convert the JSON to a string using the string function. Then, the replace() function is used to remove the specified strings and replace them with another string. Then, it is converted back to JSON format using the JSON expression.
- Now, click on the Save icon to save the flow. Then, run the flow.
- After the flow runs successfully, open the compose action, and it removes the string value “Low” and produces output like below.

Check out Filter Array in Power Automate Examples
Example 2: Power Automate Replace Special Characters in JSON
I will explain this with another example, ie, replacing special characters in json with blank values.
Let’s say you have a JSON string for Project details that is present in an unusual format, such as \r and escaped quotes.
{
"ProjectName\r": "Intranet Portal Design\r",
"Manager": "David Smith",
"ProjectID\r": "\"PRJ-001789\"\r"
}
In the json mentioned above, I wanted to replace the special character “\r” with a blank value.
As you already know, how to create a Power Automate flow. Do start from the steps below:
- Below the trigger, add a “Compose” action that will store the JSON object. Provide your Json in the Inputs parameter of compose.
{
"ProjectName\r": "Intranet Portal Design\r",
"Manager": "David Smith",
"ProjectID\r": "\"PRJ-001789\"\r"
}
- Now, I will take another Compose to provide the expression that will replace the special characters with blank values. See the expression below.
json(replace(replace(string(outputs('Compose_-_Special_Characters')),'\r', ''), '\"', ''))
Save and run the flow.
- Once the flow runs successfully, you can check the output in the Compose action. Have a look at the reference image.

This way, you can replace the special characters in a JSON by using Power Automate.
Check out Replace Value in an Array in Power Automate
Example 3: Replace Empty String with Null Values in JSON using Power Automate
In this section, I will describe how to replace the empty string values in json with null values using Power Automate.
In the example below, you can see that I have a Project Details in a JSON object, which contains StartDate and EndDate fields with empty string values. Now, we will replace these empty strings with null values.

Go through the replace() expression below:
- Add a ‘Compose‘ action and set the expression as given in the code below.
Inputs: json(replace(string(outputs('Compose_-_Project_Details')),'""','null'))
- Then, save and manually run the Power Automate flow. Once the flow is executed, you can check the result in the compose outputs, where the StartDate and EndDate will be replaced with null values. Have a look at the screenshot below.

You can use the replace() function to replace the text strings, characters, or any other text values with new text values using Power Automate.
In this tutorial, I will explain how to replace a String in JSON using Power Automate. You can drop a comment in the comments section if you have any questions or suggestions.
You may like the following tutorials:
- Power Automate String Functions
- Decimal Function in Power Automate
- Power Automate startsWith() Function
- Power Automate Replace() Function
- Replace Special Characters in a String using Power Automate
- How to Replace a File in SharePoint using Power Automate?

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.