$.getJSON("http://aratarikan.com/api/posts?format=json").done(function (json) {
resultsTop = json.results;
sumTop = resultsTop.length;
for (i=0; i<sumTop; i++){
resultTop = resultsTop[i];
var event = [];
event ["id"] = resultTop.id;
event ["pu"] = resultTop.publish_date;
event ["ti"] = resultTop.title;
var events =[];
events.push(event);
console.log(events)
}
});
event is only catch last event data. for loop does not seem to be doing the job. I need to get a JSON and create a new JSON in a format other than it.
soure json: http://aratarikan.com/api/posts?format=json target json format: http://aratarikan.com/static/data.json