Skip to main content

Description

Creates a new map with a single specified key removed. The original map is not modified.

Syntax

Parameters

Returns

Type: map (object) A new map containing all properties from the input map except the specified key. Returns an empty map if input is not a valid object.

Examples

Example 1: Basic Key Removal

Output:

Example 2: Removing Sensitive Data

Example 3: Cleaning Response Data

Example 4: Removing Non-Existent Key

Output:
(Key doesn’t exist, so map is returned unchanged)

Notes

  • Returns empty map if input is not a valid object or is null
  • If key is null, returns a shallow copy of the map
  • If the key doesn’t exist, returns a copy with all original properties
  • Creates a new map; does not modify the original
  • Useful for sanitizing data, removing sensitive fields, or filtering properties

See Also

Frequently Asked Questions

No. It returns a new map with the specified key removed, leaving the original unchanged.
The function returns a copy of the original map unchanged — no error is thrown.