Parsing a complicated string

60 views Asked by At

I'm calling the Zoom API from Apps Script and it is returning data like this:

{
    "page_count": 1,
    "page_size": 30,
    "total_records": 25,
    "next_page_token": "",
    "participants": [
        {
            "id": "w8fMI8zCSl2O8iO91xxxx",
            "user_id": "16778xxx",
            "name": "Full Name Here",
            "user_email": "[email protected]",
            "join_time": "2020-10-16T15:20:30Z",
            "leave_time": "2020-10-16T15:27:16Z",
            "duration": 406,
            "attentiveness_score": ""
        },
        {
            "id": "X-1nXsOESVSK3o-7uyxxxx",
            "user_id": "16783xxx",
            "name": "Second Full Name Here ",
            "user_email": "[email protected]",
            "join_time": "2020-10-16T15:20:39Z",
            "leave_time": "2020-10-16T15:27:57Z",
            "duration": 438,
            "attentiveness_score": ""
        },
        {
            "id": "FO8ocbGgSY2uUADrT6xxxx",
            "user_id": "16784xxx",
            "name": "Full Name3Has 2Middle Names",
            "user_email": "[email protected]",
            "join_time": "2020-10-16T15:20:39Z",
            "leave_time": "2020-10-16T15:27:15Z",
            "duration": 396,
            "attentiveness_score": ""
        },
        {
            "id": "3YIYyN51SC6YboiM8Dxxxx",
            "user_id": "16785xxx",
            "name": "Full Name 4",
            "user_email": "[email protected]",
            "join_time": "2020-10-16T15:20:40Z",
            "leave_time": "2020-10-16T15:25:13Z",
            "duration": 273,
            "attentiveness_score": ""
        }
    ]
}

etc

I want to process the data and get each student's info in one row from left to right:

Student Name, Email, Join time, Leave time, Duration

Because names and emails and such are not a standard length or even a standard number of words I have failed trying to use "splice."

Is there a way for me to process it by programmatically saying something like:

make array of the part of string after "name":" and before next quotation(") mark. Then, part after "user_email": and before next quotation(") mark...and so on

Or some other way to make this data usable?

0

There are 0 answers