Parsing nested JSON in v2.analytics.conversation.aggregate webhook events

Just noticed that the payload structure for v2.analytics.conversation.aggregate events is significantly more verbose than the standard interaction events. I am trying to extract specific metric values from the metrics object, but the nesting depth varies depending on the metric type (e.g., queue_wait_time vs agent_talk_time). The documentation shows a flat example, but my webhook logs show a deeply nested values array that breaks my current deserializer.

Here is a snippet of the relevant payload section I am receiving:

{
 "metrics": [
 {
 "id": "queue_wait_time",
 "values": [
 { "value": 45.2, "type": "numeric" }
 ]
 }
 ]
}

My current logic assumes a direct property access which fails when values is an array containing objects rather than a primitive. I am using Node.js with the body-parser middleware to handle the incoming POST request from the Genesys Cloud webhook endpoint.

How do you handle this dynamic nesting in the webhook consumer? I want to avoid hardcoding checks for every possible metric type. Is there a standard utility or pattern for flattening this specific aggregate structure before processing it in the Slack Bolt framework?