---
updatedAt: 2025-05-20T20:29:08.000Z
agentTools:
  projectIndex: https://docs.documotor.com/llms.txt
---

# get_property

Get the value assigned to a key

# Definition

`any get_property(object $object, string $key)`

Retrieves the value assigned to `$key` inside `$object`. Similar to using the dot accessor as in `$object.$key`, but allows variables as `$key` rather than just a static string. Returns `null` if `$key` doesn't exist in `$object`.

# Parameters

<Glossary>object</Glossary> `$object`

Object inside which to look for the property.

<Glossary>string</Glossary> `$key`

Key inside `$object` to retrieve value of. Can be the result of an expression, see examples.

# Returns

<Glossary>any</Glossary>

The value assigned to `$key` inside `$object`.

# Examples

```json Sample data
{
  "firstName": "Jane",
  "lastName": "Doe",
  "age": 30,
  "status": {
    "Enabled": true
  },
  "roles": [
    "User",
    "Admin"
  ],
  "importantAttribute": "lastName"
}
```

```text Transformation
{
    name: get_property(@, 'firstName'),
    age: get_property(@, 'age'),
    enabled: get_property(get_property(@, 'status'), 'Enabled'),
    last_role: get_property(@, 'roles')[-1],
    lastName: get_property(@, get_property(@, 'importantAttribute')),      // impossible with . accessor
    middleName: get_property(@, 'middleName')
}
```

```json Result
{
  "name": "Jane",
  "age": 30,
  "enabled": true,
  "last_role": "Admin",
  "lastName": "Doe",
  "middleName": null
}
```