【发布时间】:2016-11-13 04:31:43
【问题描述】:
我收到以下 JSON 响应。在这个 JSON 中,我将“结果”作为 JSON 数组。我想从这个数组中检索并显示每个实例名称和相应状态的值。我该怎么做?
{
"oradbInstance" : {
"oraDBHost" : "",
"oraDBPort" : "",
"oraDBSid" : "",
"oraDBPass" : "",
"oraDBJdePass" : "",
"oraDBStatus" : "",
"oraDBDepComponent" : "",
"oraSHARED" : false,
"oraADF" : false,
"oraOVR" : false,
"oradbSchema" : {
"oraPROD" : false,
"oraPRIST" : false,
"oraCRP" : false,
"oraDEV" : false
},
"oradbDemoSchema" : {
"oraPRODDEMO" : false,
"oraPRISTDEMO" : false,
"oraCRPDEMO" : false,
"oraDEVDEMO" : false
}
},
"result" : [ {
"instanceName" : "ent6327",
"targetType" : "entserver",
"status" : "STOPPED"
}, {
"instanceName" : "ent790",
"targetType" : "entserver",
"status" : "STOPPED"
}, {
"instanceName" : "920_ENT_6017",
"targetType" : "entserver",
"status" : "RUNNING"
}, {
"instanceName" : "ent7943",
"targetType" : "entserver",
"status" : "STOPPED"
}, {
"instanceName" : "920_JAS_8082",
"targetType" : "webserver",
"status" : "RUNNING"
}, {
"instanceName" : "ENT6547",
"targetType" : "entserver",
"status" : "STOPPED"
}, {
"instanceName" : "ent4563",
"targetType" : "entserver",
"status" : "STOPPED"
}, {
"instanceName" : "ent6021",
"targetType" : "entserver",
"status" : "RUNNING"
}, {
"instanceName" : "AIS_0005",
"targetType" : "restserver",
"status" : "RUNNING"
}, {
"instanceName" : "DEN00KNL_DEP_920",
"targetType" : "depserver",
"status" : "RUNNING"
}, {
"instanceName" : "wls1213",
"targetType" : "owl_1212",
"status" : "RUNNING"
}, {
"instanceName" : "HTML_8792",
"targetType" : "webserver",
"status" : "RUNNING"
}, {
"instanceName" : "home",
"targetType" : "mgmtconsole",
"status" : "RUNNING"
}, {
"instanceName" : "ent6060_Win",
"targetType" : "entserver",
"status" : "RUNNING"
}, {
"instanceName" : "RTE_0004",
"targetType" : "rteserver",
"status" : "RUNNING"
}, {
"instanceName" : "ent6363",
"targetType" : "entserver",
"status" : "STOPPED"
} ]
}
任何有用的建议
【问题讨论】:
-
欢迎来到 Stack Overflow。我们希望看到您尝试解决此问题,而不是为您编写代码。请阅读“How to Ask”(包括链接页面)和“minimal reproducible example”。