Skip to main content

Usage

Returns all fields and values of the hash stored at key.

Parameters

key
string
required
The key of the hash

Response

object
TData | null
An object containing all field-value pairs in the hash, or null if the hash does not exist or is empty.The return type is a record where keys are field names and values are the stored values. Values are automatically parsed from JSON when possible.

Examples

Get all hash fields

Handle non-existent keys

Working with typed data

Iterate over hash fields

Store and retrieve complex data

Notes

  • The command automatically parses numeric values that are safe integers
  • JSON values are parsed when possible
  • For very large hashes, consider using HSCAN to iterate incrementally

See Also

  • HGET - Get a single hash field value
  • HKEYS - Get all field names in a hash
  • HVALS - Get all values in a hash
  • HMGET - Get multiple hash field values