here is my code:
var pictures = {};
for (var key in pics) {
//just interested in the first 3 profile pictures.
if (i < 3){
var view = Titanium.UI.createImageView({
image: pics[key].source,
width: 'auto',
height: 'auto'
});
$.scrollableView.addView(view);
//store in json object
pictures['source'] = '[' + pics[key].source + ']';
i++;
} else {
//break out of loop
break;
}
}
Ok I know in JSON to create a JSON Array the syntax is basically this:
[ { something, something 2, something 3 }],
how can I create an json array dynamically based on the code above.
pictures['source'] = '[' + pics[key].source + ']';
This only stores the last pics[key].source
in the list.