I am struggling to find a way to call data from a json URL due to the way it is nested, shown below.
[
{"data":
"Aatrox":
"id": "Aatrox"
"hp": "500"
"Ashe":
"id": "Ashe"
"hp": "350"
}]
I am trying to use the 'hp' value as the height data point for a bar graph using d3.js, and using the 'id' value as a label under each bar, but I'm unsure how to call upon the data and store it in variables that I can use in my d3 code.
d3.json("https://ddragon.leagueoflegends.com/cdn/4.7.16/data/em_us/champion.json
", function(data) {
console.log(data);
});
Currently I'm just logging the data in the console because I'm not sure how to store the specific parts of it that I want in a variable.
How to retrieve the key values of a nested data set in D3
This question helped me a little bit as a starting point but I'm still not totally sure how to proceed.
The main issue I am having is the file structure of the JSON is a bit strange and I'm not sure what 'x' would be in the case that I wanted to pull just 'hp' in:
data.'x'.stats.hp