我尝试使用Jayway JsonPath v2.4.0,但是我什至不确定是否可行。
我具有如下的JSON结构。
{
"business": {
"BusinessUnit": "",
"PriorityType": "Scheduled",
"NoPhiScrubbing": "false",
"BAMCorrelationGUID": "111390dd-2468-42d1-a360-a698a4214735",
"FileFullPath": "s3://cf-s3-f418-c87c-43e0-9c9c-6197fc3f9551/ConfigRepositoryBackUp.xml",
"SystemDNSInfoRSN_IP_Address": "",
"SystemDNSInfoRSN_DNS": "",
"Priority": "Scheduled",
"FileTransferMessage": "File download successful",
"DateInstalled": "2017-02-21T07:06:00"
}
}
当我使用如下所示的JSonPath表达式时
JSONArray jsonArray = JsonPath.read(json, "$.business.[?(@.fileFullPath == ^(.*)ConfigRepositoryBackUp(.*).xml\$')]");
我没有任何点击。我不确定我定义的正则表达式是否正确?请有人帮我解决这个问题。
尝试更改
JSONArray jsonArray = JsonPath.read(json, "$.business.[?(@.fileFullPath == ^(.*)ConfigRepositoryBackUp(.*).xml\$')]");
到
JSONArray jsonArray = JsonPath.read(json, "$.business.[?(@.FileFullPath == ^(.*)ConfigRepositoryBackUp(.*).xml\$')]");