【发布时间】:2018-05-29 03:34:51
【问题描述】:
我有一个这样的 JSON 数组 ...
[
{
"Event_code": "AB-001",
"Interest_area": "Arts and Education",
"Start_time": "9:00 AM",
"End_time": "3:00 PM",
"Session_type": "Course information session"
},
{
"Event_code": "AB-002",
"Interest_area": "Arts and Education",
"Start_time": "12:30 PM",
"End_time": "1:00 PM",
"Session_type": "Course information session"
},
{
"Event_code": "AB-003",
"Interest_area": "",
"Start_time": "9:00 AM",
"End_time": "3:00 PM",
"Session_type": "Course information session"
},
{
"Event_code": "AB-004",
"Interest_area": "Business",
"Start_time": "10:30 AM",
"End_time": "11:00 AM",
"Session_type": "Course information session"
},
{
"Event_code": "AB-005",
"Interest_area": "General Interest",
"Start_time": "9:30 AM",
"End_time": "1:30 PM",
"Session_type": "Experience"
},
{
"Event_code": "AB-006",
"Interest_area": "Environment, Business",
"Start_time": "11:00 AM",
"End_time": "11:30 AM",
"Session_type": "Course information session"
},
{
"Event_code": "AB-014",
"Interest_area": "Health sciences and allied health, Medicine",
"Start_time": "1:00 PM",
"End_time": "2:00 PM",
"Session_type": "Course information session"
}
]
我想要做的是过滤这个 JSON 并提取 unique "Interest_area" 值,其中 "Session_type" 等于 "课程说明会" ...
我的预期输出是
["艺术与教育","商业","环境"]
我已经看到this 解决方案,这与我正在寻找的非常接近,但它在我的情况下不起作用,因为我的 JSON 可能有“2 个或更多”值用于“兴趣区域”字段。
【问题讨论】:
-
您自己尝试过什么吗?有吗?一点点?
标签: javascript jquery