用模式匹配或正则匹配都可以.也可以用web.json遍历每个节点.
var str = /*************
{
"getTodoListResponseItem" : [ {
"timeCost" : "27",
"sysCode" : "5",
"toDoList" : null,
"toDoCount" : 0,
"result" : "invalid",
"errMsg" : "不存在账号"
},{
"timeCost" : "276",
"sysCode" : "6",
"toDoList" : {
"todoItem" : [ {
"pendingDate" : "2018-05-18T18:55:19.000+08:00",
"pendingUrl" : "http://www.1.com/workflow.service?record_id=7925",
"pendingTitle" : "请审批!"
}, ]
},
"toDoCount" : 1,
"result" : "valid",
"errMsg" : null
}, {
"timeCost" : "381",
"sysCode" : "9",
"toDoList" : {
"todoItem" : [ {
"remind" : "0天",
"sourceNode" : "#40",
"pendingDate" : "2018-05-18 22:49:49",
"pendingUrl" : "http://www.1.com/^36FAF209?Open",
"pendingTitle" : "申请",
"source" : "工作流程"
}, {
"remind" : "0天",
"sourceNode" : "#40",
"pendingDate" : "2018-05-18 22:49:16",
"pendingUrl" : "http://www.1.com/^AD1A744E?Open",
"pendingTitle" : "申请",
"source" : "工作流程"
}, {
"remind" : "0天",
"sourceNode" : "#40",
"pendingDate" : "2018-05-18 20:48:56",
"pendingUrl" : "http://www.1.com/^F8461212?Open",
"pendingTitle" : "流程",
"source" : "工作流程"
}, {
"remind" : "0天",
"sourceNode" : "#40",
"pendingDate" : "2018-05-18 18:46:22",
"pendingUrl" : "http://www.1.com/^ED4B9C27?Open",
"pendingTitle" : "流程",
"source" : "工作流程"
}]
},
"toDoCount" : 4,
"result" : "valid",
"errMsg" : null
} ]
}
*************/
import console;
var pattern = //pendingUrl\" \: \"(.*?)\"\,
console.dumpJson(string.matches(str,pattern))
console.pause(true);