I have a really small jquery program that is trying to get the the value fom a key. The JSON file looks like this:
{
"Key1": [
"http://a.com",
"http: //b.com",
"http://c.net"
],
"Key2": [
"http://a.com",
"http: //b.com",
"http://c.net"
],
"Key3": [
"http://a.com",
"http: //b.com",
"http://c.net"
]
}
I am trying to get the value of one by the key. Here is my code:
$.getJSON('url_dict.json', function(json) {
$.each(json, function(key, value) {
if (key == "Key1") {
console.log(key.value);
} else {
console.log("Nope");
};
});
});
All I ever get is Nope. If I change it to key, value, they print it out fine. I only have an issue if I try to drill down by key.