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 / Set a value in a neste...
Power Automate
Unanswered

Set a value in a nested JSON Object variable

(0) ShareShare
ReportReport
Posted on by 31

Hello all,

 

I'm hoping someone can help me / point me in the right direction with this, I've been struggling for a while on it now and cannot find any real solution online (that works) despite my assumption that this would be a straight forward task.

 

The Scenario

Each week, I receive the current list of stores active in my organisation (around 800 at any one time) in Excel format. Each row of this Excel is a single store, with columns of data about that store (name, unique store ID, the address of the store, the address of the business that owns the store (can be different to the address of the actual store), etc.)

I have an extensive set of flows that then read in the Excel data, take each store and look at the data in each column for that store, do some text clean-up (removing unwanted characters, capitalising the first letter of each word in some cases, removing extra spaces, converting dates to correct format, etc.)

The "Transform" actions I perform are done through Child Flows, which then return a "cleaned / cleansed" version of the text back to the main flow.

 

The Goal / Current Challenge

My idea is to encapsulate all the cleaned-up data coming back from each of the Child flows into a JSON object, with nested JSON objects inside it to structure the data in a single Object variable.

 

My problem is I cannot seem to set data for nested values.

 

I get various errors and / or unexpected outcomes.

 

 

My Test Flow

Because the actual JSON Object is somewhat larger, I have created a test flow (below) to simulate the issue.

 

Step 1 -I'm triggering the test flow manually, then Initializing an Object variable:

 

LeeS_0-1718018912669.png

The structure of the Object is as follows. It has 3 nested objects (People, Store and Business):

 

{
  "StoreID""",
  "Language""",
  "People": {
    "Owners""",
    "Managers"""
  },
  "Store": {
    "Name""",
    "Street_Address"""
  },
  "Business": {
    "BizName""",
    "BizStreet_Address"""
  }
}

 

Step 2 - Set the value of the Street Address for the store in a compose action. I got this method / approach from researching my issue online (set the value in a compose action then set the variable to the outputs of the compose (Step 3):

 

LeeS_1-1718020000389.png

The Expression used in the above Compose is as follows:

setProperty(variables('IncomingStore')['Store'],'Street_Address','Main Street 100')
 
 
Step 3 - Set the variable to the Outputs of the previous Compose action:
 
LeeS_2-1718020158575.png

 

This all runs fine and gives the following result:

 

LeeS_3-1718020254795.png

 

The Compose action seems to only provide the output of the Store nested object, so I am assuming it has placed it in the correct fields in the object and inside the Store sub-object?:

 

LeeS_4-1718020333695.png

 

Looks a bit confusing, as I would have expected the whole object to be shown with only the values updated as being changed, something like the following:

 

{
  "StoreID""",
  "Language""",
  "People": {
    "Owners""",
    "Managers"""
  },
  "Store": {
    "Name""",
    "Street_Address""Main Street 100"  <-- New value here in the nested object "Store"
  },
  "Business": {
    "BizName""",
    "BizStreet_Address"""
  }
}
 
 
If I take the next step and try to add another Compose and Set Variable action set to add the Business Address in the same way, I get an error;
 
LeeS_1-1718027103612.png

 


 

 

produces this error, saying the "Business" property doesn't exist:

 

LeeS_0-1718027051932.png

 

Unable to process template language expressions in action 'Set_the_value_of_the_Business_address_property' inputs at line '0' and column '0': 'The template language expression 'setProperty(variables('IncomingStore')['Business'],'BizStreet_Address','123 Some Other Street')' cannot be evaluated because property 'Business' doesn't exist, available properties are 'Name, Street_Address'. Please see https://aka.ms/logicexpressions for usage details.'.

 
 
Any and all help and advice would be appreciated!
Categories:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    on at

    Hi , @LeeS 

    I test it in my side , this is the result :

    vyueyunmsft_0-1718069594004.png

    This is my test flow, you can refer to :

    vyueyunmsft_1-1718069668142.png

     

    setProperty(variables('IncomingStore') , 'Store', setProperty(variables('IncomingStore')['Store'], 'Street_Address', 'Main Street 100'))
    setProperty(variables('IncomingStore') , 'Business', setProperty(variables('IncomingStore')['Business'], 'BizStreet_Address', '123 Some Other Street'))

     

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

     

     

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 398 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 323 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 183 Most Valuable Professional

Last 30 days Overall leaderboard