Get Dictionary Keys

Contains the custom function, dictUtil_getKeys, that returns a list of keys in the dictionary. If it is a nested dictionary, only the keys of the top-level dictionary will be returned.

This function is typically used in cases where a dynamic set of key/values must be passed. You can provide a dictionary, call this function to retrieve the keys and then loop through them with an a!forEach or another similar construct.

 

The following example retrieves a list of all values in top-level elements of a dictionary. It would return the list: {1,2}.

with(
  local!dict: ({x: 1, y: 2}),
  local!keys: dictutil_getkeys(local!dict),
  a!forEach(
    items: local!keys,
    expression:         
       index(local!dict, fv!item, {})
  )
)