I have a configuration object like so:
// set to $.config
{
"DE": {
"hello": "hallo"
},
"EN": {
"hello": "hallo"
},
"ES": {
"hello": "hola"
}
}
which has been set in the variable $.config
in a step function and a var $.language
set to DE
.
Now i would love to select the right key in doing something like:
Next Step:
Type: Pass
Parameters:
localizedHello.$: $.config[$.language].hello
^ this sadly does not work
...
Do you know a better way then using a pass step
?
I know the example below works but it is really a cumbersome approach!
Its is German:
Type: Pass
Parameters:
localizedConfig.$: $.config.DE
ResultPath: $.selected
Next: Next Step
Next Step:
Type: Pass
Parameters:
localizedHello.$: $.selected.localizedConfig.hello
...
Also there is no Intrinsic Function for it, like:
Next Step:
Type: Pass
Parameters:
localizedHello.$: States.Get(States.Get($.config, $.language), 'hello')
...
Unfortunately, there's not a way to do what you're asking.
Fortunately, we're building a spec for JSON Path now. I've added your use case to a proposal that would support what you're looking for.