Javascript 解析复杂字符串
我从应用程序脚本调用Zoom API,它返回如下数据:Javascript 解析复杂字符串,javascript,string,parsing,google-apps-script,zoom-sdk,Javascript,String,Parsing,Google Apps Script,Zoom Sdk,我从应用程序脚本调用Zoom API,它返回如下数据: { "page_count": 1, "page_size": 30, "total_records": 25, "next_page_token": "", "participants": [ { "id": "
{
"page_count": 1,
"page_size": 30,
"total_records": 25,
"next_page_token": "",
"participants": [
{
"id": "w8fMI8zCSl2O8iO91xxxx",
"user_id": "16778xxx",
"name": "Full Name Here",
"user_email": "email1@gmail.com",
"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": "email2@gmail.com",
"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@gmail.com",
"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": "email4@gmail.com",
"join_time": "2020-10-16T15:20:40Z",
"leave_time": "2020-10-16T15:25:13Z",
"duration": 273,
"attentiveness_score": ""
}
]
}
等
我想处理数据,从左到右一行获取每个学生的信息:
Student Name, Email, Join time, Leave time, Duration
因为姓名和电子邮件等都不是标准长度,甚至不是标准字数,所以我尝试使用“拼接”时失败了
我有没有办法通过编程的方式来处理它,比如:
将字符串中“name”:“之后和下一个引号(“)之前的部分设置为数组。然后,在“user\u email”之后的部分:
和下一个引号(“)之前…等等
或者通过其他方式使此数据可用?我想,
JSON.parse()
肯定是一个开始。是的,这里有一个数据结构。不应该将其作为字符串处理。