Simply try something like:
@activity('YourActivity').output.rates.USD
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I am trying to use lookup in ADF where I need the value of USD in below JSON which I am getting as response from REST API:
{"success":true,"timestamp":1692866883,"base":"GBP","date":"2023-08-24","rates":{"USD":1.269479}}
I am trying to use the "@activity" function in expression builder to get to the value of USD key value, but this showing as invalid.
Kindly share the right approach to get the value of the JSON key "USD" in above.
Regards
Simply try something like:
@activity('YourActivity').output.rates.USD
You can extract the value of the "USD" key in the given JSON using the ADF expression language. I assume you've assigned the JSON object to a variable or have it in an output from a previous activity, you would typically use an expression like the following:
@activity('YourPreviousActivityName').output.success.rates.USD
However, the expression language doesn't allow direct access to JSON properties that use an unsupported character, like a numeric character at the start of the property name (as it is the case with "1692866883" in your JSON). Since you are only interested in the "USD" key, it shouldn't be a problem.
I added the .success becauce it will accesse the "success" property in the JSON object. (same for the others)