任何人都可以帮忙为以下内容写正则表达式:我需要从下面提取UserId并将其传递给其他发布数据。
{
"Mentors": [],
"Participants": [],
"UserAndRoles": [
{
"UserAndRoleId": "7d5fc1b9-b11b-4971-a49a-6e553e442e31",
"UserId": 6501,
"RoleId": 11,
"CFDYear": "2017-18"
}
],
"UserId": 6501,
"MobileNo": null,
"Gender": null,
"CreatedOn": "2017-09-05T16:53:05.47",
"UpdatedOn": "2018-08-09T04:11:57.217",
"IsActive": true,
}
答案 0 :(得分:1)
使用JSON Extractor从JSON中提取值,您在第2级中拥有"_source": {
"experiences": [
{
"company": {
"industry": "IT",
"name": "company name"
}
},
{
"company": {
"industry": null,
"name": "company name"
}
}
]
}
,因此在下面使用两个点作为正则表达式:
UserId
或在级别1中获取UserId:
$..UserId
选择匹配编号$.UserId
以获取第一个值。
答案 1 :(得分:0)
您只需要使用不带任何点的“ UserId”