I've been trying for a while to get the JSON
of the API
of League of Legends data and I can not find a way. I give the example of one of the JSON
that I can not go.
{
"23385178": {
"summonerId": 23385178,
"pages": [
{
"id": 34451272,
"name": "Thresh",
"current": false,
"masteries": [
{
"id": 6342,
"rank": 1
},
{
"id": 6241,
"rank": 1
},
{
"id": 6311,
"rank": 5
},
{
"id": 6221,
"rank": 1
},
{
"id": 6211,
"rank": 5
},
{
"id": 6322,
"rank": 1
},
{
"id": 6332,
"rank": 5
},
{
"id": 6232,
"rank": 5
},
{
"id": 6362,
"rank": 1
},
{
"id": 6352,
"rank": 5
}
]
},
{
"id": 34451273,
"name": "Alistar",
"current": false,
"masteries": [
{
"id": 6342,
"rank": 1
},
{
"id": 6311,
"rank": 5
},
{
"id": 6241,
"rank": 1
},
{
"id": 6221,
"rank": 1
},
{
"id": 6211,
"rank": 5
},
{
"id": 6322,
"rank": 1
},
{
"id": 6332,
"rank": 5
},
{
"id": 6231,
"rank": 5
},
{
"id": 6352,
"rank": 5
},
{
"id": 6362,
"rank": 1
}
]
}
]
}
}
The JSON
I'm treating as I read in another post here.
$(document).ready(function() {
$.ajax({
url: "https://euw.api.riotgames.com/api/lol/EUW/v1.4/summoner/23385178/masteries?api_key=RGAPI-de016c14-78f2-4e19-82a7-33526d8bed4c",
dataType: "json",
}).then(function(data) {
$('.parrId').append();
$('.parrName').append();
$('.parrIcon').append();
$('.parrLvl').append();
});
});
My intention is to place in the different paragraphs (parrId, parrName, etc) the information extracted from JSON
. Obviously I would have to go through it to extract all the information, but I am unable to extract the first element, I think the name of array
is bothering me.