0

I am trying to access a value in a Dataweave object via a variable whose value equals the key. So, if

var obj = {"a": 2}
var x = "a"

then I want something like obj.x to return 2.

obj.x, obj.(x) don't work. I thought accessing the value via the key's index might work using something like obj[(keysOf(obj) find "a")]. But that didn't work either for reasons that I don't understand. Thanks for the help!

0 Answers0