PingOne

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
{
  'userId': 100001,
  'name': {
    'first': user.name.given,
    'last': user.name.family
  },
  'departmentIds': new int[] {101, 102}
}
Using unquoted keys
{
  userId: 100001,
  name: {
    first: user.name.given
  }
}
Using a top level property value as key using #root
{
  #root.externalId: 100001
}
Using a top level property value as key using #this
{
  #this.externalId: 100001
}

Empty map or object

\{:}

Access a map

{
  'userId': 100001,
  'name': {
    'first': user.name.given,
    'last': user.name.family
  },
  'departmentIds': new int[] {101, 102}
}['name']['first']

Access an object

{
  'userId': 100001,
  'name': {
    'first': user.name.given,
    'last': user.name.family
  },
  'departmentIds': new int[] {101, 102}
}.name.first

Object access against literals causes an error if an incorrect or missing property is accessed, as shown in the following example:

{
  'name': {
    'first': user.name.given,
    'last': user.name.family
  }
}.name.middle