Update json property

up:: PowerAutomate

Power Automate Expressions How To: setProperty
How to Add/ Remove property from a JSON object dynamically using Power Automate - Debajit's Power Apps & Dynamics 365 Blog

In order to add new property to JSON, you can use SetProperty() function:

setProperty(body('Parse_JSON_-_is_file_locked')?['IsLocked'],false)

A property also can be nested inside of existing JSON object:

addProperty(json('{ "Address": { "City": "Milpitas", "State": "CA" } }')['Address'], 'ZipCode', '750321')

If there is a need of adding an object to JSON, you can parse multiple JSON files and then combine results.

This works:

// Parse_JSON
{
"Condition": "Good"
}
// Parse_JSON_-_Status_array
[
	{
	"Status": "Doing"
	},
	{"Status": "Done"
	}
]
// final input
addProperty(body('Parse_JSON'), 'Status', body('Parse_JSON_-_Status_array')[0])
This won't work due non existing property:

addProperty(json('{ "Address": { "City": "Milpitas", "State": "CA" } }')['Location'], 'Country', 'USA')

But this one does:

addProperty(json('{ "Address": { "City": "Milpitas", "State": "CA" } }'), 'Location', json('{"Country": "USA"}'))

And outputs:

{
  "Address": {
    "City": "Milpitas",
    "State": "CA"
  },
  "Location": {
    "Country": "USA"
  }
}