---
title: Maps and objects
description: "Define a map or object in the same way as a JSON object. Access a map using [], or access an object using dot notation. For example, {'<key>': <value>}."
component: pingone
page_id: pingone:pingone_expression_language:p1_expressionlang_maps_objects
canonical_url: https://docs.pingidentity.com/pingone/pingone_expression_language/p1_expressionlang_maps_objects.html
revdate: May 3, 2024
---

# Maps and objects

Define a map or object in the same way as a JSON object. Access a map using `[]`, or access an object using dot notation. For example, `{'<key>': <value>}`.

If the property key contains any characters other than alphanumeric characters or underscores, you must access it using `[]`. Null keys are discarded.

Map or object keys can be quoted or unquoted. If an unquoted key only contains alphanumeric characters or underscores, it is considered a literal. Otherwise, it is treated as an expression or data model property reference.

If a top level root property needs to be used as a map key which doesn't have the dot operator, use the internal variables `#root` or `#this`, as shown in the examples.

|   |                                                                                                                                               |
| - | --------------------------------------------------------------------------------------------------------------------------------------------- |
|   | The following examples are formatted with line breaks for readability, however expressions cannot contain line breaks or new line characters. |

| Command                | Example                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Define a map or object | * Using quoted keys```json
{
  'userId': 100001,
  'name': {
    'first': user.name.given,
    'last': user.name.family
  },
  'departmentIds': new int[] {101, 102}
}
```* Using unquoted keys```json
{
  userId: 100001,
  name: {
    first: user.name.given
  }
}
```* Using a top level property value as key using `#root````json
{
  #root.externalId: 100001
}
```* Using a top level property value as key using `#this````json
{
  #this.externalId: 100001
}
``` |
| Empty map or object    | `\{:}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Access a map           | ```json
{
  'userId': 100001,
  'name': {
    'first': user.name.given,
    'last': user.name.family
  },
  'departmentIds': new int[] {101, 102}
}['name']['first']
```                                                                                                                                                                                                                                                                                                    |
| Access an object       | ```json
{
  'userId': 100001,
  'name': {
    'first': user.name.given,
    'last': user.name.family
  },
  'departmentIds': new int[] {101, 102}
}.name.first
```&#xA;&#xA;Object access against literals causes an error if an incorrect or missing property is accessed, as shown in the following example:&#xA;&#xA;{&#xA;  'name': {&#xA;    'first': user.name.given,&#xA;    'last': user.name.family&#xA;  }&#xA;}.name.middle                                      |
