I'd like to use a variable to help me dig into a json object. I know I want to use "r1m1" in this case but I won't necessarily know where that key will appear in the json structure.
json structure...
{
"matchups": {
"r1m1": {
"category": "Cat 1",
"team1": "Team 1",
"team2": "Team 2"
},
"r1m2": {
"category": "Cat 2",
"team1": "Team 1",
"team2": "Team 2"
}
}
}
Here I am trying unsuccessfully to use "currentpage" to get at the "r1m1" team name.
var currentPage = "r1m1";
$.getJSON("json.js", function(data) {
var thisvalue = data.matchups. + currentPage + .team1;
alert(thisvalue);
}
data.matchups[currentPage].team1, Bracket notation.