我正在使用以下代码进行 REST OUTBOUND 调用,并且按预期工作。但我正在尝试解析第二个响应正文,但我无法检索对象下的值。
try {
var r = new sn_ws.RESTMessageV2('test', 'post');
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.print(response.getBody());
gs.print(response.getStatusCode());
var JsonObject = JSON.parse(responseBody);
var sid = JsonObject.sid;
gs.print(sid);
var r1 = new sn_ws.RESTMessageV2('x_257605_test.gateways', 'POST' );
r1.setRequestHeader("X-chkp-sid",sid );
var response1 = r1.execute();
var responseBody1 = response1.getBody();
var httpStatus = response1.getStatusCode()
gs.print(response1.getBody());
var JsonObject1 = JSON.parse(responseBody1);
gs.print(JsonObject1.objects.uid);
}
catch(ex) {
var message = ex.message;
}
请查看示例 json 响应,我需要提取 uid/name/cluster-member-names 等对象下的值