jsonazureazure-data-factoryexpressionoracle-adf

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.


Solution

  • 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