How to extract array index number?

To get the length of an array, in a change node
set msg. payload
to JSONata J: $count($$.payload.data)
where payload.data is the path to the array

Or in a function node

msg.payload = msg.payload.data.length;
return msg;
1 Like