Legacy Dev Forum Posts

 View Only

Sign Up

Expandable Fields of Conversation Detail

  • 1.  Expandable Fields of Conversation Detail

    Posted 06-05-2025 18:08

    Vinay_Katta | 2022-06-13 04:38:10 UTC | #1

    Hi,

    We are trying to extract data for the Conversation Detail by calling the API through Python. While extracting the data we have observed few fields (i.e. arrays) are expandable like the Metrics, Mediaendpointstats and Flow etc. These are nested arrays and they don't exist all the time. When there aren't nested arrays the values for these fields are "None".

    If you look at the below JSON snippet for Mediaendpointstats array, there is a nested array.

    Question - As we are trying to convert the semi structured JSON to a structured CSV file which later is ingested to a table, what is the best way to handle such a scenario using Python for data extraction ?

    Conversation1: 'conversationid': '43362fa3-33e5-4117-8a72-05a3126a744d' 'mediaendpointstats': [{'codecs': ['audio/PCMA'], 'discardedpackets': None, 'duplicatepackets': None, 'eventtime': datetime.datetime(2022, 5, 25, 0, 54, 45, 597000, tzinfo=tzutc()), 'invalidpackets': None, 'maxlatencyms': 84, 'minmos': 4.393716549186179, 'minrfactor': 92.42170715332031, 'overrunpackets': None, 'receivedpackets': 1576, 'underrunpackets': None}, {'codecs': ['audio/opus'], 'discardedpackets': None, 'duplicatepackets': None, 'eventtime': datetime.datetime(2022, 5, 25, 0, 54, 45, 643000, tzinfo=tzutc()), 'invalidpackets': None, 'maxlatencyms': 30, 'minmos': 4.882312921390206, 'minrfactor': 92.43939971923828, 'overrunpackets': None, 'receivedpackets': 1619, 'underrunpackets': None}]

    Thanks & Regards, Vinay


    tim.smith | 2022-06-13 19:59:33 UTC | #2

    Vinay_Katta, post:1, topic:15106
    These are nested arrays and they don't exist all the time. When there aren't nested arrays the values for these fields are "None".

    This is expected. Analytics results only contain elements for which data exists. If there's no data for something, it won't exist in the response.

    Vinay_Katta, post:1, topic:15106
    As we are trying to convert the semi structured JSON to a structured CSV file which later is ingested to a table, what is the best way to handle such a scenario using Python for data extraction ?

    Your code should be tolerant of optional data. What you do in those cases depends entirely on how you're writing your code and what your use case requires for that scenario.


    system | 2022-07-14 19:59:46 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 15106