Skip to content

Map Lookup

The map::lookup function retrieves the value associated with a specified key in a map.

Syntax

map::lookup(<map>, <key>, <default>)

Parameters

  • map: The input map to search.
  • key: The key whose associated value is to be retrieved.
  • default: The default value when the key is not found.

Returns

  • Value: The value associated with the specified key. Returns null if the key does not exist.

Example

Try it out below!
map::lookup({"name": "Alice", "age": 30}, "age", "default")

This function is useful for accessing specific values within a map by key.