web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to replace null st...
Power Automate
Answered

How to replace null string values in a JSON array?

(0) ShareShare
ReportReport
Posted on by 6

I have a workflow which runs a DAX query against a Power BI report and returns results in a JSON array. This array has 4 null values that a later step in my workflow does not like and honestly the output will look better by replacing them as well.

 

Below is a partial snippet of the JSON output. As I mentioned you can see 2 of the nulls here, 1 for Broad LOB and 1 for Marketing Segments. The other 2 are further down in the array and both are nulls for the marketing segment, but in the case of those 2 the rows do have populated Broad LOB values.

{
"results": [
{
"tables": [
{
"rows": [
{
"Mart Policy Term[Broad LOB]": null,
"Mart Policy Term[Marketing Segments]": null,
 
This is what the output looks like as is
mfisherCMI_0-1715093138492.png
 
And here is what I would like it to look like
mfisherCMI_0-1715093365566.png

 

I have initialized 4 variables which each include the string value I want to use as a replacement, "Overall", "Total", "PL-Total" and "CL-Total". I think the next step is a select action using the JSON output but I feel like it is only giving me the option to select all Broad LOB's or Marketing Segments and I only want to replace the ones that are Null. How do I key on the specific Null Broad LOB and null Marketing segments an ensure each gets replaced with the correct variable?

 

Update 1: As per the usual as soon as I ask my brain kicks in and now I am wondering if I can use a condition to check for Broad LOB is null or Marketing Segment is Personal Lines and Broad LOB is null to make sure it replaces the specific instances as needed. Does this make sense?

Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,515 Super User 2026 Season 1 on at

    Check the coalesce() function

  • mfisher-CMI Profile Picture
    6 on at

    Yeah that seems like a good option, but I am still unsure where to put the coalesce. I've tried it in a few different spots in the workflow and its still not working.

  • Verified answer
    Chriddle Profile Picture
    8,515 Super User 2026 Season 1 on at

    Chriddle_1-1715108091738.png

     

    Select

    From (rows from your JSON)

    [
     {
     "Mart Policy Term[Broad LOB]": null,
     "Mart Policy Term[Marketing Segments]": null
     },
     {
     "Mart Policy Term[Broad LOB]": "your original value",
     "Mart Policy Term[Marketing Segments]": "your other original value"
     }
    ]

     Map Mart Policy Term[Broad LOB]

    coalesce(item()?['Mart Policy Term[Broad LOB]'], 'Your default value')

    Map Mart Policy Term[Marketing Segments]

    coalesce(item()?['Mart Policy Term[Marketing Segments]'], 'Your other default value')

     

    Chriddle_2-1715108506182.png

     

  • mfisher-CMI Profile Picture
    6 on at

    Thanks, that is a partial fix I ended up finding myself late yesterday. I say partial fix because that allows me to correct the 1 null Broad LOB, but requires all the null Marketing Segments to be replaced with the same value. Which is probably good enough, but I would prefer each replaced with a value that makes more sense for that specific field. Additionally, after making this change yesterday I then noticed a 2nd workflow I have set up to move rows from 1 excel table to another is now malfunctioning when it was working properly before. I am not sure if that is happening because of this change or now, still investigating that. But as that workflow is using the Marketing Segments as a Key for the rows to move, I am wondering if having "Total" already in Marketing Segments once and then also replacing 2 null values thus meaning the word Total is in the Marketing Segments column 3 times now, might be messing up the way the key/value system works. But I don't really know exactly how that works. Will keep testing and report back and/or make a new post for a new issue as this one is for the most part resolved. Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 248 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 207 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 101 Super User 2026 Season 1

Last 30 days Overall leaderboard