KEYS
Last updated
Was this helpful?
Last updated
Was this helpful?
The function KEYS takes an Object and returns a List containing all the keys from the key-value pairs associated with the Object.
This function takes a single as input. It returns a single of : all of the keys from the key-value pairs associated with the given object. The order of key-value pairs in an object is not deterministic; as a result, neither is the order of the values in the resulting list.
object (required, type: Object) Any object.
list_of_values (type: List) A List containing all the keys from the key-value pairs in the input object. These keys will always be strings.
Note that the order of name-value pairs in an object is not deterministic; as a result, neither is the order of the keys in the resulting list.
Assume the following example has access to the following object:
To obtain a List of the keys associated with an Object within an Object, the nested Object must be given directly to the function KEYS. This is what is done in the following example, where dot notation allows value associated with "internal_object" ( {"first_name": "Jane", "last_name": "Doe"} to be accessed as example_object.internal_object:
Note that values in the key-value pairs within example_object consists of myriad The the value associated with "number" is a (1), values associated with "string1" and "string2" are ("hello" and "this is a string, John", respectively), and the value associated with "internal_object" is a ( {"first_name": "Jane", "last_name": "Doe"} ). This Object was chosen not because it is particularly likely to be encountered it in the wild, but to emphasize that the values within an object used as input for the KEYS function do not at all need to be same type as each other. The following example takes example_object and outputs a List containing the keys from the key-value pairs that make up example_object. Note that while, in this example, the order of the items in the returned List matches the order of the keys given in the Object, this is not guaranteed to be the case. The order of key-value pairs in an object is not deterministic; as a result, neither is the order of the values in the resulting list:
The KEYS function takes an object and returns a List containing all of the keys from the key-value pairs associated with the given object. To instead obtain List of the values, use the function .