Looking to loop through JSON that comes back like this in javascript and access the 'line' and other variables.
{
"2":{"league":"MLB","matchnum":"2","site":"1","line":"-120","teamname":"COL"},
"1":{"league":"MLB","matchnum":"1","site":"2","line":"111","teamname":"SF"}
}
This appears to be the answer but I think the issue is i'm trying to access a value thats in an object in an object.
for(var i = 0; i < json.length; i++) {
var obj = json[i];
console.log(obj.id);
}
Where I am going wrong here? Thanks a lot for your time.