Reputation: 319
We have an incoming JSON message and would like to add some additional JSON data (JSON object with some fields) to the original message. How can I add the JSON Object "GlossDef" to the position outlined below?
{
"glossary":{
"title":"example glossary",
"GlossDiv":{
"title":"S",
"GlossList":{
"GlossEntry":{
"ID":"SGML",
"SortAs":"SGML",
"GlossTerm":"Standard Generalized Markup Language",
"Acronym":"SGML",
"Abbrev":"ISO 8879:1986",
*** "GlossDef":{
*** "para":"A meta-markup language, used to create markup languages such as DocBook.",
*** "GlossSeeAlso":[
*** "GML",
*** "XML"
*** ]
*** },
"GlossSee":"markup"
}**
}
}
}
}
Upvotes: 3
Views: 8321
Reputation: 1656
Take a look at the 'addProperty' method in the expressions tab. Here is a question on the powerusers platform regarding this.
I validated it in a test example with the following steps:
Step 1 - This is the initial object where ever you are getting it from.
Step 2 - This is just initializing a variable with the object to add, you may have to do this in some dynamic fashion but the concept is still the same.
Step 3 - Parse the object from step one, so we can extract the sub object we want to append to.
Step 4 - Extract the sub object in this case we will choose 'GlossEntry' from the Dynamic Content list coming from the parse json.
Step 5 - Using a compose, use the expression tab and use the 'appProperty' to add 'ObjectToAdd' into 'ChildObject'. Look like this: addProperty(variables('ChildObject'), 'GlossDef', variables('ObjectToAdd'))
That should get you on the right path.
Upvotes: 2