I have an API that returns a response. The response contains a "data" field that I can access with response.data. It looks like this:
{
statusCode: 201,
timestamp: '2021-06-26T12:39:40-07:00',
timestampMs: 1624736380095,
shortMessage: 'Created',
longMessage: 'Created',
errors: [],
customs: [ { key: 'contactId', value: '379332970' } ]
}
response.data.customs looks like this:
[ { key: 'contactId', value: '1193400871' } ]
I need to access only the value of contactId in the customs field.
I tried response.data.customs.contactId, response.data.customs.[contactId] etc. and nothing works. I'm sure I'm missing something simple here. Can anyone help?
EDIT: Without needing to complicate things, the simplest solution is: response.data.customs[0].value