I'm trying to access nested JSON data inside a JSON using jQuery but I seem to be missing something. I keep getting console errors: Uncaught TypeError: Cannot use 'in' operator to search for '34' in [{'1.png','2.png','3.png','4.png'}] so I know my issue has to do something with the nested data. I've tried several different ways to get around this which I commented in my jsfiddle link below.
Not sure if I'm doing something wrong or if my nested data is simply formatted wrong: http://jsfiddle.net/hg6631am/1/
$(document).ready(function() {
var json = [{
"title":"Vendor Website",
"desc":"Vendor Website Vendor Website Vendor Website",
"album":"[{'1.png','2.png','3.png','4.png'}]",
"version":"1.0"
},
{
"title":"Vendor Profile",
"desc":"Vendor Profile Vendor Profile Vendor Profile",
"album":"[{'1.png','2.png','3.png'}]",
"version":"1.0"
}];
$.each(json,function(k,v) {
$('#box').append("<h3>Title "+k+": "+v.title+"</h3>");
$('#box').append("<h3>Album "+k+": "+v.album+"</h3>");
$.each(v.album,function(i,x) {
$('box').append("<h3>Album "+k+", Value #"+i+": "+x);
});
});
});