我是新手,我正在尝试从 json 结构中提取特定的密钥,如下所示。
{
"cluster_name": "escluster",
"nodes": {
"Sd2AvEXsswjTn6ErRYjg": {
"timestamp": 1460624696217,
"name": "master1",
"transport_address": "10.0.0.1:9300",
"host": "10.0.0.1:9300",
"ip": [
"10.0.0.1:9300",
"NONE"
],
"attributes": {
"data": "false",
"master": "true"
},
"os": {
"timestamp": 1460624696217,
"cpu_percent": 0,
"load_average": 0,
"mem": {
"total_in_bytes": 163987664,
"free_in_bytes": 136357264,
"used_in_bytes": 26629400,
"free_percent": 84,
"used_percent": 16
},
"swap": {
"total_in_bytes": 0,
"free_in_bytes": 0,
"used_in_bytes": 0
}
}
},
"yzabB-OaTfOqvgAELIMq1Q": {
"timestamp": 1460624938213,
"name": "data_1",
"transport_address": "10.0.0.2:9300",
"host": "10.0.0.2",
"ip": [
"10.0.0.2:9300",
"NONE"
],
"attributes": {
"master": "false"
},
"os": {
"timestamp": 1460624938213,
"cpu_percent": 0,
"load_average": 0.29,
"mem": {
"total_in_bytes": 623840000,
"free_in_bytes": 4127648,
"used_in_bytes": 666012352,
"free_percent": 1,
"used_percent": 99
},
}
},
由于节点名称是动态的,我想为每个节点检索mem。我发现这是 为了检索数据,但它不是动态密钥。我们如何才能做到这一点。
幕布斯6054654
相关分类