---
url: /nestjs-odata/api/generated/functions/parseODataKey.md
---
# Function: parseODataKey()

> **parseODataKey**(`keyStr`, `keyProperties`): `Record`<`string`, `unknown`>

Defined in: [utils/odata-key-parser.ts:49](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/utils/odata-key-parser.ts#L49)

Parse an OData parenthetical key string into a Record of key-value pairs.

## Parameters

### keyStr

`string`

The key string extracted from parentheses (e.g., '42', "'hello'", 'OrderId=1,ItemId=3')

### keyProperties

readonly `string`\[]

Ordered list of key property names (used for simple keys)

## Returns

`Record`<`string`, `unknown`>

Record mapping property names to coerced values

## Throws

Error if keyStr is empty
