Error getting a value from a nested JSON array

Hello,

I’m getting the following error when attempting to get a value from a nested JSON array:

error: Could not access blank value: Use || to provide a default value for blank fields. Example: (my_field || 0) + 1

Example abbreviated payload:

{
  "toleranceHistories: [
  {
    "values": [
    {
      "type": "Count"
    }],
    "approvalRanges": [
    {
      "type": "Count"
    }]
  }]
}

I need to copy the value of values[0].type to approvalRanges[0].type using the formula values[0][‘type’], but that results in the above error.

Any ideas?

Figured this one out, instead of:

values[0]['type']

you have to do:

field('values')[0]['type']