For a given payload:
{
"a": "Hello world"
}
and a variable:
var test = {"b": "a"}
I would like to get "Hello world" using the variable test's key, "b".
I tried payload.(test."b") and does not work.
For a given payload:
{
"a": "Hello world"
}
and a variable:
var test = {"b": "a"}
I would like to get "Hello world" using the variable test's key, "b".
I tried payload.(test."b") and does not work.
You can achieve this using dynamic selectors.
%dw 2.0
output application/json
var test = {"b": "a"}
---
payload[test.b]