amit.k.maurya.16
amit.k.maurya.16

Reputation: 7

How to build expression in ADF from json using parameterized variable?

I have one activity output like this

{
    "firstRow": {
        "mapping": "{\"CHRSCRT\":\"CHRT\",\"CST\":\"CUSTOM\"}"
    }
}

an second activity output like

{
    "name": "FF",
    "value": "CST"
}

Now i want to take only one value from mapping table using the second variable.

I tried

@{json(activity('1stActivity').output.firstRow.mapping)}.@{variables('secondActivity')}}

I want output like CUSTOM

But i am getting output {\"CHRSCRT\":\"CHRT\",\"CST\":\"CUSTOM\"}.CST

Please help in this expression builder in ADF.

Upvotes: 0

Views: 75

Answers (1)

Rakesh Govindula
Rakesh Govindula

Reputation: 11529

I want output like CUSTOM

To achieve your requirement, you can modify your dynamic expression without string interpolation like below.

@json(activity('1stActivity').output.firstRow.mapping)[variables('secondActivity')]

enter image description here

Here, it uses [] notation instead of . to specify the key from the secondActivity output.

Result:

enter image description here

Upvotes: 0

Related Questions