Parsing nested metrics in Genesys v2.analytics.conversation.aggregate webhook

The v2.analytics.conversation.aggregate webhook payload is throwing off our parser. The structure is deeply nested and inconsistent across event types.

{
 "data": {
 "metrics": {
 "holdTime": {
 "avg": 12.5
 }
 }
 }
}

We are struggling to extract the avg value reliably in our consumer logic. The path changes if the metric type is different. We have tried:

  • Using a generic JSON path library
  • Hardcoding paths for specific metric types
  • Checking the eventType field first

The logic feels brittle and we are missing edge cases. How are you handling this dynamic nesting in your consumers?