【发布时间】:2017-07-09 13:11:32
【问题描述】:
我在从 JSON 中检索值时遇到问题
我不知道如何检索在 id 之后给出的值 [NAME](它是随机的)
"allplayers": {
"76561197979570214": {
"clan": "FBÏ",
"name": "phr",
"observer_slot": 6,
"team": "T",
},
"76561198156373160": {
"clan": "ZOWIE",
"name": "TOAO",
"observer_slot": 7,
"team": "T",
},
"76561198071702537": {
"clan": "Team Biceps",
"name": "snatchie",
"observer_slot": 8,
"team": "T",
},
},
具有常数值
"map": {
"mode": "competitive",
"name": "de_overpass",
"phase": "live",
"round": 7,
"team_ct": {
"score": 7,
"name": "Team Kinguin",
"flag": "PL",
"timeouts_remaining": 1,
"matches_won_this_series": 0
},
"team_t": {
"score": 0,
"name": "Samsung4Gamers",
"flag": "PL",
"timeouts_remaining": 1,
"matches_won_this_series": 0
},
"num_matches_to_win_series": 0,
"current_spectators": 3,
"souvenirs_last_round": 0,
"souvenirs_total": 0
},
我正在使用
data = JSON.parse(msg);
$("#ct_score").text(data.map.team_ct.score);
谁能帮帮我?谢谢!
【问题讨论】:
-
这把钥匙是否总是带有team字样?
标签: javascript json node.js decode