【发布时间】:2014-07-14 21:52:41
【问题描述】:
我很困惑为什么我使用的 extractVariables 规则会按原样返回数据。见下文。
要解析的json是:
{
"callNotificationSubscriptionList": {
"playAndCollectInteractionSubscription": [],
"recognitionInteractionSubscription": [],
"playAndRecordInteractionSubscription": [],
"callDirectionSubscription": [],
"callEventSubscription": [
{
"clientCorrelator": "112345",
"resourceURL": "http:someurl",
"callbackReference": {
"notifyURL": "someotherurlt",
"notificationFormat": "XML"
},
"filter": {
"data1": "data abc",
"data2": "data def",
"data3": "data xyz"
}
}
]
}
}
规则:
<JSONPayload>
<Variable name="callNotSubL">
<!-- <JSONPath>$.callNotificationSubscriptionList</JSONPath> -->
<JSONPath>$.*</JSONPath>
</Variable>
</JSONpayload>
当我使用被注释掉的值时,我没有得到响应变量数据。如果我将“ignoreUnresolvedVariables”参数设置为“false”,我将返回失败,因此它没有数据。因此,我尝试了 "$.*" 有了这个,我被退回了:
[
{
"callbackReference": {
"notifyURL": "someotherurlt",
"notificationFormat": "XML"
},
"filter": {
"data1": "data abc",
"data2": "data def",
"data3": "data xyz"
}
}
]
这可能是因为 EntryNames 太长了吗?我承认它们很长,但它们远低于 JSON Threat Potection Policy 中的默认值。
我确实通过基于 Web 的 JSONPayload 解析器和 $.callNotificationSubscriptionList 和 $.callNotificationSubscriptionList.callEventSubscription[0] 工作正常来抽取这个 json,这正是我真正追求的。但是,如果我不能正确获得顶级,我就根本无法获得子级别。
【问题讨论】:
标签: json variables extract apigee