第一步
从字段或者文件中选取json源
第二步
字段定义如何解析源json
上面对应的json如下:
{
"expand": "description,lead,url,projectKeys",
"self": "http://172.26.1.51:8080/rest/api/2/project/10902",
"id": "10902",
"key": "SAMPLE",
"description": "",
"lead": {
"self": "http://172.26.1.51:8080/rest/api/2/user?username=summ",
"key": "summ",
"name": "summ",
"avatarUrls": {
"48x48": "http://172.26.1.51:8080/secure/useravatar?ownerId=summ&avatarId=10600",
"24x24": "http://172.26.1.51:8080/secure/useravatar?size=small&ownerId=summ&avatarId=10600",
"16x16": "http://172.26.1.51:8080/secure/useravatar?size=xsmall&ownerId=summ&avatarId=10600",
"32x32": "http://172.26.1.51:8080/secure/useravatar?size=medium&ownerId=summ&avatarId=10600"
},
"displayName": "苏敏敏",
"active": true
},
"components": [],
"issueTypes": [
{
"self": "http://172.26.1.51:8080/rest/api/2/issuetype/10100",
"id": "10100",
"description": "需要完成的任务。",
"iconUrl": "http://172.26.1.51:8080/secure/viewavatar?size=xsmall&avatarId=10318&avatarType=issuetype",
"name": "任务",
"subtask": false,
"avatarId": 10318
},
{
"self": "http://172.26.1.51:8080/rest/api/2/issuetype/10101",
"id": "10101",
"description": "问题的子任务",
"iconUrl": "http://172.26.1.51:8080/secure/viewavatar?size=xsmall&avatarId=10316&avatarType=issuetype",
"name": "子任务",
"subtask": true,
"avatarId": 10316
},
{
"self": "http://172.26.1.51:8080/rest/api/2/issuetype/10102",
"id": "10102",
"description": "由 Jira Software 创建——请勿编辑或删除。适用于一种用户故事的事务类型。",
"iconUrl": "http://172.26.1.51:8080/secure/viewavatar?size=xsmall&avatarId=10315&avatarType=issuetype",
"name": "故事",
"subtask": false,
"avatarId": 10315
},
{
"self": "http://172.26.1.51:8080/rest/api/2/issuetype/10103",
"id": "10103",
"description": "",
"iconUrl": "http://172.26.1.51:8080/secure/viewavatar?size=xsmall&avatarId=10303&avatarType=issuetype",
"name": "故障",
"subtask": false,
"avatarId": 10303
},
{
"self": "http://172.26.1.51:8080/rest/api/2/issuetype/10000",
"id": "10000",
"description": "Created by Jira Software - do not edit or delete. Issue type for a big user story that needs to be broken down.",
"iconUrl": "http://172.26.1.51:8080/images/icons/issuetypes/epic.svg",
"name": "Epic",
"subtask": false
}
],
"assigneeType": "UNASSIGNED",
"versions": [],
"name": "Scrum项目模板",
"roles": {
"Test supervisor": "http://172.26.1.51:8080/rest/api/2/project/10902/role/10104",
"Product Manager": "http://172.26.1.51:8080/rest/api/2/project/10902/role/10102",
"Developers": "http://172.26.1.51:8080/rest/api/2/project/10902/role/10101",
"Product Tester": "http://172.26.1.51:8080/rest/api/2/project/10902/role/10106",
"Project Manager": "http://172.26.1.51:8080/rest/api/2/project/10902/role/10103",
"Administrators": "http://172.26.1.51:8080/rest/api/2/project/10902/role/10002",
"Developer": "http://172.26.1.51:8080/rest/api/2/project/10902/role/10105"
},
"avatarUrls": {
"48x48": "http://172.26.1.51:8080/secure/projectavatar?avatarId=10324",
"24x24": "http://172.26.1.51:8080/secure/projectavatar?size=small&avatarId=10324",
"16x16": "http://172.26.1.51:8080/secure/projectavatar?size=xsmall&avatarId=10324",
"32x32": "http://172.26.1.51:8080/secure/projectavatar?size=medium&avatarId=10324"
},
"projectTypeKey": "software",
"archived": false
}
如何解析json数组
[
{
"expand": "description,lead,url,projectKeys",
"self": "http://172.26.1.51:8080/rest/api/2/project/10902",
"id": "10902",
"key": "SAMPLE",
"name": "Scrum项目模板",
"avatarUrls": {
"48x48": "http://172.26.1.51:8080/secure/projectavatar?avatarId=10324",
"24x24": "http://172.26.1.51:8080/secure/projectavatar?size=small&avatarId=10324",
"16x16": "http://172.26.1.51:8080/secure/projectavatar?size=xsmall&avatarId=10324",
"32x32": "http://172.26.1.51:8080/secure/projectavatar?size=medium&avatarId=10324"
},
"projectTypeKey": "software"
},
{
"expand": "description,lead,url,projectKeys",
"self": "http://172.26.1.51:8080/rest/api/2/project/10904",
"id": "10904",
"key": "SYBI",
"name": "SyBI",
"avatarUrls": {
"48x48": "http://172.26.1.51:8080/secure/projectavatar?avatarId=10324",
"24x24": "http://172.26.1.51:8080/secure/projectavatar?size=small&avatarId=10324",
"16x16": "http://172.26.1.51:8080/secure/projectavatar?size=xsmall&avatarId=10324",
"32x32": "http://172.26.1.51:8080/secure/projectavatar?size=medium&avatarId=10324"
},
"projectTypeKey": "software"
}
]
如上所示的json是一个array,如何获取id呢?
注意是 $.[*]id