0

There are three set variables activity in my pipeline returning three Ids namely ID0, ID1 and ID2. I would like to combine their output into a new set variable activity whose output has a json format as shown below:

{"Data": 
{
"ID0": "ABC",
"ID1": "2022",
"ID2": "1234",
}
}

I have looked into the other questions asked here but most of them addresses the concern of converting / storing the output in a Json file. I am not willing to export any output to Json file rather just use it as a variable to feed in to another pipelines.

Lav Mehta
  • 92
  • 1
  • 2
  • 13
  • Why do you want to convert in json to pass variables to another pipeline you can directly create variables or parameter in that pipeline ad use that. – Pratik Lad Oct 18 '22 at 11:48
  • @PratikLad I want to send a message to a service bus pipeline that requires to read a Json input. – Lav Mehta Oct 18 '22 at 12:28

1 Answers1

0

I created a new Set Variable activity, and used the following expression to combine all three variables:

{{"Data":{"ID0":"@{variables('ID_0')}","ID1":"@{variables('ID_1')}","ID2":"@{variables('ID_2')}"}}}

That gave me the following result in the Json format:

{
"name": "ouput",
"value": "{{\"Data\":{\"ID0\":\"ABC\",\"ID1\":\"2022\",\"ID2\":\"1234\"}}}"
}

This video was helpful in creating the expression.

Lav Mehta
  • 92
  • 1
  • 2
  • 13