Le comento tengo un archivo en formato JSON desde el cual tomo algunos valores, a este archivo se le agregó un nuevo array (SetList) con nuevas variable y no logro resolver el planeto para pode extraer los valores de las variables en el array. Todo ayuda sera bienvenida. Gracias
Fuente:
Código:
{"Genero 1" : [ {"id" : "404","videoType" : "guestapt","fps" : "24","isWideScreen" : "1","published" : "Wed, 15 Jun 2011 11:43:22 -0400","title" : "The Guest Apartment - 6.15.2011","thumbnail" : "http://bandcontent.com/imagen-150.jpg","url" : "http://web.net/Marling_Session_768_1500.mp4", "SetList":{"songs":[{"song":"Interview","start":"0","end":"1488"},{"song":"Sophia","start":"1889","end":"7872"},{"song":"Interview","start":"7873","end":"8832"},{"song":"Rest in the Bed","start":"8833","end":"13008"},{"song":"Interview","start":"13009","end":"16608"},{"song":"The Muse","start":"16609","end":"21120"},{"song":"Interview","start":"21121","end":"23328"}]}} , {"id" : "402","videoType" : "guestapt","fps" : "24","isWideScreen" : "1","published" : "Fri, 29 Jul 2011 11:28:36 -0400","title" : "he Bowery Electric - 7.29.2011","thumbnail" : "http://bandcontent.com/imagen-151.jpg","url" : "http://web.net/Goulding_Session_1500.mp4", "SetList":{"songs":[{"song":"Guns and Horses","start":"0","end":"7084"},{"song":"Interview","start":"7085","end":"9253"},{"song":"Lights","start":"9254","end":"14166"},{"song":"Interview","start":"14167","end":"16532"},{"song":"Starry Eyed","start":"16533","end":"20839"},{"song":"Interview","start":"20840","end":"22436"}]}} ]
Código JS
Código:
$.getJSON('fuente.txt', function(sources){ for (var i=0; i<categories.length; i++) { var catName = categories[i]; var category = { name: catName, videos: [], SetList: [], }; for (var j=0; j<sources[catName].length; j++) { var videoInfo = sources[catName][j]; var video = { thumb: videoInfo.thumbnail, title: videoInfo.title, subtitle: '', description: [], sources: [videoInfo.url] }; //Compruebo si existe SetList if(typeof(SetList) !== 'undefined') { var SetList = { }; } category.videos.push(video); } data.categories.push(category); } startCallback(data); });