나는 어떤 의미로든 프로그래머 또는 코더가 아니다. 나는 Riot api를 사용하여 내 전설의 리그 중 일부를 다른 곳에서 사용하기 위해 zapier로 가져 오려고합니다. json 데이터를 얻을 수 있습니다. 단지 모든 통계에 대해 10 데이터 포인트를 반환합니다. 난 그냥 첫 번째 데이터 지점을 원한다. 이것은 데이터를 얻기 위해 사용하는 코드입니다.Zapier를 사용하여 JSON 배열의 첫 번째 값을 얻으려면 어떻게해야합니까?
fetch('https://na.api.pvp.net/api/lol/na/v1.3/game/by-summoner/61645956/recent?api_key=<myapikey>')
.then(function(res) {
return res.json();
})
.then(function(json) {
callback(null, json);
})
.catch(callback);
하고이 배열을 반환은 :
{
"summonerId":61645956,
"games":[
{
"gameId":2305710206,
"invalid":false,
"gameMode":"CLASSIC",
"gameType":"MATCHED_GAME",
"subType":"RANKED_SOLO_5x5",
"mapId":11,
"teamId":200,
"championId":89,
"spell1":14,
"spell2":4,
"level":30,
"ipEarned":62,
"createDate":1475123835392,
"fellowPlayers":[
{
"summonerId":26402335,
"teamId":100,
"championId":122
},
{
"summonerId":51664526,
"teamId":100,
"championId":81
},
{
"summonerId":38071418,
"teamId":200,
"championId":103
},
{
"summonerId":36515003,
"teamId":200,
"championId":18
},
{
"summonerId":48012068,
"teamId":200,
"championId":48
},
{
"summonerId":48064897,
"teamId":100,
"championId":143
},
{
"summonerId":45687834,
"teamId":200,
"championId":36
},
{
"summonerId":50239478,
"teamId":100,
"championId":120
},
{
"summonerId":30496298,
"teamId":100,
"championId":1
}
],
"stats":{
"level":13,
"goldEarned":9165,
"numDeaths":5,
"minionsKilled":47,
"championsKilled":3,
"goldSpent":8725,
"totalDamageDealt":26070,
"totalDamageTaken":25068,
"team":200,
"win":false,
"largestMultiKill":1,
"physicalDamageDealtPlayer":8335,
"magicDamageDealtPlayer":10398,
"physicalDamageTaken":15010,
"magicDamageTaken":6577,
"timePlayed":2033,
"totalHeal":2665,
"totalUnitsHealed":5,
"assists":10,
"item0":3401,
"item1":3190,
"item2":2049,
"item3":1031,
"item4":3111,
"item5":3751,
"item6":3364,
"magicDamageDealtToChampions":3997,
"physicalDamageDealtToChampions":2654,
"totalDamageDealtToChampions":7461,
"trueDamageDealtPlayer":7336,
"trueDamageDealtToChampions":810,
"trueDamageTaken":3480,
"wardKilled":2,
"wardPlaced":22,
"totalTimeCrowdControlDealt":125,
"playerRole":2,
"playerPosition":4,
"visionWardsBought":1
}
},
{
"gameId":2305656152,
"invalid":false,
"gameMode":"CLASSIC",
"gameType":"MATCHED_GAME",
"subType":"RANKED_SOLO_5x5",
"mapId":11,
"teamId":100,
"championId":98,
"spell1":3,
"spell2":4,
"level":30,
"ipEarned":51,
"createDate":1475121422227,
"fellowPlayers":[
{
"summonerId":44847062,
"teamId":200,
"championId":222
},
{
"summonerId":35024451,
"teamId":200,
"championId":75
},
{
"summonerId":36515003,
"teamId":100,
"championId":81
},
{
"summonerId":26655780,
"teamId":100,
"championId":77
},
{
"summonerId":22046951,
"teamId":200,
"championId":161
},
{
"summonerId":37418996,
"teamId":100,
"championId":112
},
{
"summonerId":37164256,
"teamId":200,
"championId":121
},
{
"summonerId":36386214,
"teamId":200,
"championId":412
},
{
"summonerId":70059201,
"teamId":100,
"championId":122
}
],
"stats":{
"level":11,
"goldEarned":6345,
"numDeaths":4,
"minionsKilled":33,
"championsKilled":1,
"goldSpent":5750,
"totalDamageDealt":17563,
"totalDamageTaken":15701,
"team":100,
"win":false,
"largestMultiKill":1,
"physicalDamageDealtPlayer":9109,
"magicDamageDealtPlayer":1575,
"physicalDamageTaken":6874,
"magicDamageTaken":6798,
"timePlayed":1519,
"totalHeal":2132,
"totalUnitsHealed":3,
"assists":8,
"item0":3401,
"item1":3047,
"item2":2049,
"item3":3105,
"item6":3341,
"magicDamageDealtToChampions":1081,
"physicalDamageDealtToChampions":3906,
"totalDamageDealtToChampions":4988,
"trueDamageDealtPlayer":6878,
"trueDamageTaken":2029,
"wardKilled":2,
"wardPlaced":11,
"totalTimeCrowdControlDealt":112,
"playerRole":2,
"playerPosition":4
}
},
{
"gameId":2305599567,
"invalid":false,
"gameMode":"CLASSIC",
"gameType":"MATCHED_GAME",
"subType":"RANKED_SOLO_5x5",
"mapId":11,
"teamId":100,
"championId":267,
"spell1":3,
"spell2":4,
"level":30,
"ipEarned":117,
"createDate":1475119366312,
"fellowPlayers":[
{
"summonerId":36515003,
"teamId":100,
"championId":236
},
{
"summonerId":24318381,
"teamId":200,
"championId":121
},
{
"summonerId":58801818,
"teamId":100,
"championId":48
},
{
"summonerId":71530149,
"teamId":100,
"championId":85
},
{
"summonerId":429991,
"teamId":200,
"championId":26
},
{
"summonerId":36467378,
"teamId":200,
"championId":110
},
{
"summonerId":80651936,
"teamId":100,
"championId":64
},
{
"summonerId":21785827,
"teamId":200,
"championId":115
},
{
"summonerId":54995317,
"teamId":200,
"championId":114
}
],
"stats":{
"level":18,
"goldEarned":14932,
"numDeaths":6,
"minionsKilled":32,
"goldSpent":13325,
"totalDamageDealt":42834,
"totalDamageTaken":28128,
"team":100,
"win":true,
"physicalDamageDealtPlayer":17326,
"magicDamageDealtPlayer":24972,
"physicalDamageTaken":18318,
"magicDamageTaken":9570,
"timePlayed":2621,
"totalHeal":25516,
"totalUnitsHealed":5,
"assists":25,
"item0":3092,
"item1":3190,
"item2":2045,
"item3":3117,
"item4":3504,
"item5":3050,
"item6":3364,
"magicDamageDealtToChampions":10608,
"physicalDamageDealtToChampions":1632,
"totalDamageDealtToChampions":12241,
"trueDamageDealtPlayer":535,
"trueDamageTaken":240,
"wardKilled":3,
"wardPlaced":26,
"totalTimeCrowdControlDealt":269,
"playerRole":2,
"playerPosition":4,
"totalDamageDealtToBuildings":5540,
"visionWardsBought":3
}
},
{
"gameId":2305593891,
"invalid":false,
"gameMode":"CLASSIC",
"gameType":"MATCHED_GAME",
"subType":"RANKED_SOLO_5x5",
"mapId":11,
"teamId":200,
"championId":26,
"spell1":3,
"spell2":4,
"level":30,
"ipEarned":96,
"createDate":1475116337677,
"fellowPlayers":[
{
"summonerId":59240130,
"teamId":200,
"championId":90
},
{
"summonerId":37737286,
"teamId":200,
"championId":5
},
{
"summonerId":48134049,
"teamId":100,
"championId":25
},
{
"summonerId":52001343,
"teamId":200,
"championId":104
},
{
"summonerId":23929258,
"teamId":100,
"championId":67
},
{
"summonerId":36515003,
"teamId":200,
"championId":236
},
{
"summonerId":71539264,
"teamId":100,
"championId":133
},
{
"summonerId":73074002,
"teamId":100,
"championId":103
},
{
"summonerId":57259369,
"teamId":100,
"championId":23
}
],
"stats":{
"level":15,
"goldEarned":10822,
"numDeaths":5,
"turretsKilled":2,
"minionsKilled":46,
"championsKilled":1,
"goldSpent":9800,
"totalDamageDealt":60871,
"totalDamageTaken":14379,
"team":200,
"win":true,
"largestMultiKill":1,
"physicalDamageDealtPlayer":7532,
"magicDamageDealtPlayer":53339,
"physicalDamageTaken":7061,
"magicDamageTaken":6431,
"timePlayed":2090,
"totalHeal":8278,
"totalUnitsHealed":5,
"assists":14,
"item0":3092,
"item1":3158,
"item2":2049,
"item3":3512,
"item4":3165,
"item6":3364,
"magicDamageDealtToChampions":8992,
"physicalDamageDealtToChampions":1933,
"totalDamageDealtToChampions":10925,
"trueDamageTaken":886,
"wardKilled":1,
"wardPlaced":11,
"totalTimeCrowdControlDealt":201,
"playerRole":2,
"playerPosition":4,
"totalDamageDealtToBuildings":1733,
"visionWardsBought":2
}
},
{
"gameId":2305548000,
"invalid":false,
"gameMode":"CLASSIC",
"gameType":"MATCHED_GAME",
"subType":"RANKED_SOLO_5x5",
"mapId":11,
"teamId":100,
"championId":26,
"spell1":3,
"spell2":4,
"level":30,
"ipEarned":76,
"createDate":1475113731759,
"fellowPlayers":[
{
"summonerId":50558512,
"teamId":100,
"championId":81
},
{
"summonerId":29276199,
"teamId":100,
"championId":51
},
{
"summonerId":36654393,
"teamId":200,
"championId":240
},
{
"summonerId":36515003,
"teamId":100,
"championId":223
},
{
"summonerId":76800634,
"teamId":200,
"championId":11
},
{
"summonerId":50445070,
"teamId":200,
"championId":222
},
{
"summonerId":52201449,
"teamId":200,
"championId":4
},
{
"summonerId":11625,
"teamId":100,
"championId":106
},
{
"summonerId":30564904,
"teamId":200,
"championId":89
}
],
"stats":{
"level":13,
"goldEarned":8724,
"numDeaths":2,
"turretsKilled":1,
"minionsKilled":38,
"championsKilled":1,
"goldSpent":6360,
"totalDamageDealt":52177,
"totalDamageTaken":7009,
"team":100,
"win":true,
"neutralMinionsKilled":6,
"largestMultiKill":1,
"physicalDamageDealtPlayer":8451,
"magicDamageDealtPlayer":43726,
"physicalDamageTaken":5381,
"magicDamageTaken":1470,
"timePlayed":1519,
"totalHeal":1931,
"totalUnitsHealed":1,
"assists":7,
"item0":3092,
"item1":3158,
"item2":2049,
"item3":3108,
"item4":3802,
"item5":1052,
"item6":3364,
"magicDamageDealtToChampions":5029,
"physicalDamageDealtToChampions":974,
"totalDamageDealtToChampions":6004,
"trueDamageTaken":157,
"wardPlaced":14,
"neutralMinionsKilledEnemyJungle":3,
"neutralMinionsKilledYourJungle":3,
"totalTimeCrowdControlDealt":214,
"playerRole":2,
"playerPosition":4,
"totalDamageDealtToBuildings":5840,
"visionWardsBought":1
}
},
{
"gameId":2305542650,
"invalid":false,
"gameMode":"CLASSIC",
"gameType":"MATCHED_GAME",
"subType":"RANKED_SOLO_5x5",
"mapId":11,
"teamId":200,
"championId":25,
"spell1":3,
"spell2":4,
"level":30,
"ipEarned":82,
"createDate":1475111487614,
"fellowPlayers":[
{
"summonerId":49111930,
"teamId":100,
"championId":17
},
{
"summonerId":29149315,
"teamId":200,
"championId":107
},
{
"summonerId":36515003,
"teamId":200,
"championId":104
},
{
"summonerId":69370945,
"teamId":100,
"championId":115
},
{
"summonerId":25972662,
"teamId":100,
"championId":53
},
{
"summonerId":73929624,
"teamId":200,
"championId":2
},
{
"summonerId":36783010,
"teamId":100,
"championId":236
},
{
"summonerId":35386736,
"teamId":200,
"championId":61
},
{
"summonerId":29070094,
"teamId":100,
"championId":5
}
],
"stats":{
"level":14,
"goldEarned":10650,
"numDeaths":1,
"barracksKilled":1,
"turretsKilled":2,
"minionsKilled":34,
"championsKilled":2,
"goldSpent":8650,
"totalDamageDealt":51368,
"totalDamageTaken":10392,
"killingSprees":1,
"largestKillingSpree":2,
"team":200,
"win":true,
"neutralMinionsKilled":1,
"largestMultiKill":1,
"physicalDamageDealtPlayer":10713,
"magicDamageDealtPlayer":40654,
"physicalDamageTaken":3723,
"magicDamageTaken":6620,
"timePlayed":1698,
"totalHeal":1437,
"totalUnitsHealed":1,
"assists":16,
"item0":3092,
"item1":2031,
"item2":2049,
"item3":3157,
"item4":3020,
"item5":3105,
"item6":3364,
"magicDamageDealtToChampions":10747,
"physicalDamageDealtToChampions":1355,
"totalDamageDealtToChampions":12103,
"trueDamageTaken":48,
"wardKilled":3,
"wardPlaced":18,
"neutralMinionsKilledYourJungle":1,
"totalTimeCrowdControlDealt":151,
"playerRole":2,
"playerPosition":4,
"bountyLevel":2,
"totalDamageDealtToBuildings":5974
}
},
{
"gameId":2305309550,
"invalid":false,
"gameMode":"CLASSIC",
"gameType":"MATCHED_GAME",
"subType":"RANKED_SOLO_5x5",
"mapId":11,
"teamId":200,
"championId":26,
"spell1":3,
"spell2":4,
"level":30,
"ipEarned":230,
"createDate":1475109305903,
"fellowPlayers":[
{
"summonerId":58049719,
"teamId":100,
"championId":412
},
{
"summonerId":57761286,
"teamId":100,
"championId":18
},
{
"summonerId":60661724,
"teamId":200,
"championId":51
},
{
"summonerId":69852470,
"teamId":200,
"championId":245
},
{
"summonerId":35240348,
"teamId":200,
"championId":41
},
{
"summonerId":64891806,
"teamId":100,
"championId":99
},
{
"summonerId":19810065,
"teamId":200,
"championId":154
},
{
"summonerId":72219120,
"teamId":100,
"championId":64
},
{
"summonerId":29290889,
"teamId":100,
"championId":19
}
],
"stats":{
"level":13,
"goldEarned":9891,
"numDeaths":2,
"minionsKilled":46,
"championsKilled":2,
"goldSpent":8925,
"totalDamageDealt":54060,
"totalDamageTaken":8547,
"team":200,
"win":true,
"neutralMinionsKilled":7,
"largestMultiKill":1,
"physicalDamageDealtPlayer":5671,
"magicDamageDealtPlayer":48342,
"physicalDamageTaken":3440,
"magicDamageTaken":5107,
"timePlayed":1676,
"totalHeal":4528,
"totalUnitsHealed":2,
"assists":17,
"item0":3092,
"item1":3158,
"item2":2049,
"item3":3165,
"item4":3105,
"item5":1028,
"item6":3364,
"magicDamageDealtToChampions":8314,
"physicalDamageDealtToChampions":1984,
"totalDamageDealtToChampions":10299,
"trueDamageDealtPlayer":45,
"wardKilled":1,
"wardPlaced":15,
"neutralMinionsKilledEnemyJungle":7,
"totalTimeCrowdControlDealt":256,
"playerRole":2,
"playerPosition":4,
"totalDamageDealtToBuildings":2077,
"visionWardsBought":1
}
},
{
"gameId":2305304640,
"invalid":false,
"gameMode":"CLASSIC",
"gameType":"MATCHED_GAME",
"subType":"RANKED_SOLO_5x5",
"mapId":11,
"teamId":100,
"championId":89,
"spell1":3,
"spell2":4,
"level":30,
"ipEarned":64,
"createDate":1475107215636,
"fellowPlayers":[
{
"summonerId":34093650,
"teamId":100,
"championId":75
},
(. 내가이 게시의 일부를 차단했다, 그것은 너무 오래했다)하지만 zapier에이 포맷 등 : http://imgur.com/a/Muqi9
이 코드에 무엇을 추가하거나 각 필드의 첫 번째 값을 가져 오기 위해 다른 동작 코드를 실행할 수 있습니까? 그 말이 맞는다면. 감사!
'Obj.games.length = EXPECTED_GAMES' – Rayon