Search code examples
jsonata

In JSONATA, how to fetch values from object using variable


$test := 'Account Name';

I need to know how can I use the variable as a key. These are not working:

  1. $.$test
  2. $.[$test]
  3. $[$test]

Solution

  • You can use $lookup function to access a dynamically defined key:

    $lookup($, $test)
    

    See it on the playground: https://stedi.link/TYRXYoy