You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

JavaScript中无法从JSON获取playerStats数据的问题求助

无法获取JSON中的playerStats数据问题

我有如下JSON对象:

{
    "playerTiles":{
        "32f31063-29e4-47e8-93d0-cc68a27aa619":[
            "0,0,10,23",
            "1,0,8,8",
            "2,3,8,86",
            "3,0,1,14",
            "4,0,9,9",
            "5,3,2,80",
            "6,1,4,30",
            "7,1,9,48",
            "8,1,11,50",
            "9,1,13,52",
            "10,0,13,26",
            "11,0,12,25",
            "12,3,4,95",
            "13,3,2,93",
            "14,3,10,101",
            "15,1,1,40"
        ],
        "3d60a7d7-9b55-4a49-83e7-9e30f8f84e2e":[
            "0,2,2,54",
            "1,1,5,31",
            "2,2,3,68",
            "3,2,3,55",
            "4,1,6,45",
            "5,0,4,17",
            "6,0,12,12",
            "7,0,1,1",
            "8,3,10,88",
            "9,3,12,90",
            "10,3,5,96",
            "11,0,7,7",
            "12,1,4,43",
            "13,3,11,89",
            "14,3,13,104",
            "15,3,13,91"
        ]
    },
    "playerStats":{
        "32f31063-29e4-47e8-93d0-cc68a27aa619":{
            "status":"open",
            "swaps":"0",
            "tileSum":"117",
            "token":"",
            "lang":"en",
            "country":"",
            "message":false,
            "reminder":0.0,
            "won":0.0,
            "row":0.0,
            "top":0.0,
            "winner":0.0,
            "moves":0.0,
            "passes":0.0,
            "swapped":0.0
        },
        "3d60a7d7-9b55-4a49-83e7-9e30f8f84e2e":{
            "status":"open",
            "swaps":"0",
            "tileSum":"111",
            "token":"",
            "lang":"en",
            "country":"US",
            "message":false,
            "reminder":0.0,
            "won":0.0,
            "row":0.0,
            "top":0.0,
            "winner":0.0,
            "moves":0.0,
            "passes":0.0,
            "swapped":0.0
        }
    }
}

执行以下代码时,返回结果为空对象:

let playerStats = jsonArray.playerStats;
// 返回:{}

但执行这段代码能正常获取到数据:

let playerTiles = jsonArray.playerTiles;

返回的数据为:

{
    "3d60a7d7-9b55-4a49-83e7-9e30f8f84e2e": [
        "0,0,2,2",
        "1,0,5,18",
        "2,2,3,55",
        "3,3,13,91",
        "4,0,6,19",
        "5,2,1,53",
        "6,0,7,20",
        "7,0,3,16",
        "8,0,11,24",
        "9,3,6,84",
        "10,4,0,106",
        "11,3,13,104",
        "12,1,10,49",
        "13,0,13,26",
        "14,2,13,65",
        "15,3,9,100"
    ],
    "32f31063-29e4-47e8-93d0-cc68a27aa619": [
        "0,1,6,32",
        "1,1,1,40",
        "2,2,9,74",
        "3,1,12,38",
        "4,4,0,105",
        "5,2,8,60",
        "6,2,7,72",
        "7,0,9,22",
        "8,3,5,83",
        "9,3,1,79",
        "10,2,7,59",
        "11,2,6,71",
        "12,1,13,52",
        "13,2,9,61",
        "14,0,11,11",
        "15,0,8,21"
    ]
}

请问如何正确获取playerStats数据?感谢帮助!


内容的提问来源于stack exchange,提问作者Mansa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 21:06:18