这是我的测试数据:如何指示特定的JSON路径?
{
"errorCode": null,
"errorMessage": null,
"responseItems": [
{
"errorCode": null,
"errorMessage": null,
"personId": "FCC2",
"personCode": "SUNEETHA",
"personFirstName": "suneetha",
"personLastName": "Durgam",
"office": "London",
"officeCode": "L",
"department": "Product",
"departmentCode": "PR",
"subDepartment": "QA",
"subDepartmentCode": "QA",
"timeOffStaffSummaryDTO": [
{
"officeCode": null,
"startMonthYear": null,
"endMonthYear": null,
"personId": null,
"alphaId": null,
"continent": null,
"allowancesIntotal": 20,
"allowancesUsed": 0,
"allowancesSubmitted": 0,
"allowancesApproved": 0,
"allowancesRemaining": 20,
"timeOffType": {
"id": 4001,
"continent": "EU",
"alphaId": "9J",
"code": "PTO",
"description": "Personal Time Offdd",
"account": "MADMIN",
"colourCode": "#CCCCCC",
"approvalRequired": true,
"commentRequired": false,
"paid": true
},
"timeOffTypeWithoutAllowance": false
}
]
}
]
}
我试图去使用此路径的Timeoff类型描述:
$.responseItems[0].timeOffStaffSummaryDTO[0].timeOffType.description
现在,这适用于任何JSON路径测试我在网上尝试,但该模板不会在页面标题栏中显示此值。
在重复细节带,我也试图显示此:
$.responseItems.timeOffStaffSummaryDTO[0].timeOffTypeWithoutAllowance
试了一下没有$符号或第一点,没有什么区别,它总是显示为空。我也尝试过在字段描述中或作为属性“net.sf.jasperreports.json.field.expression”的值。
我错过了什么?
许多,非常感谢 - 特别是花时间显示代码和输出!我的查询定义是正确的,但我的字段定义已关闭 - 我需要摆脱.responseItems位。使用JSONPath非常新,直到现在才处理xml数据。 – user2668539
@ user2668539您的欢迎,感谢您的接受 –