{"result":[[{"Image":{"__type":"File","name":"tfss-772aedb6-2767-4935-88f8-ae9280bc512b-expendables.jpg","url":"http://f
iles.parsetfss.com/49a11e0f-0c84-417e-b81b-58f5e97abae9/tfss-772aedb6-2767-4935-88f8-ae9280bc512b-expendables.jpg"},"Tit
le":"The Expendables 3","featured_actors":" Sylvester Stallone, Jason Statham, Jet Li","genre":"Action, Adventure, Thril
ler","imdb_rating":6.3,"plot_summary":"Barney augments his team with new blood for a personal battle: to take down Conra
d Stonebanks, the Expendables co-founder and notorious arms trader who is hell bent on wiping out Barney and every singl
e one of his associates.","running_time_mins":126,"trailer_video_link":"http://www.imdb.com/rg/VIDEO_PLAY/LINK//video/im
db/vi1896197145/","viewer_rating":"18","objectId":"8cTkg769gM","createdAt":"2014-08-16T21:32:28.318Z","updatedAt":"2014-
08-16T21:35:56.217Z","__type":"Object","className":"Movie"}],[{"Image":{"__type":"File","name":"tfss-65707002-e78b-47bd-
9c7a-da072f388e25-deliver.jpg","url":"http://files.parsetfss.com/49a11e0f-0c84-417e-b81b-58f5e97abae9/tfss-65707002-e78b
-47bd-9c7a-da072f388e25-deliver.jpg"},"Title":"Deliver Us From Evil","featured_actors":"Eric Bana, Édgar Ramírez, Oliv
ia Munn","genre":"Crime, Horror, Thriller","imdb_rating":6.5,"plot_summary":"New York police officer Ralph Sarchie inves
tigates a series of crimes. He joins forces with an unconventional priest, schooled in the rites of exorcism, to combat
the possessions that are terrorizing their city.","running_time_mins":118,"trailer_video_link":"http://www.imdb.com/vide
o/imdb/vi1746054425/?ref_=tt_ov_vi","viewer_rating":"15","objectId":"BoCM1zbOvh","createdAt":"2014-08-25T14:27:24.331Z",
"updatedAt":"2014-08-25T19:49:09.910Z","__type":"Object","className":"Movie"},{"Image":{"__type":"File","name":"tfss-772
aedb6-2767-4935-88f8-ae9280bc512b-expendables.jpg","url":"http://files.parsetfss.com/49a11e0f-0c84-417e-b81b-58f5e97abae
9/tfss-772aedb6-2767-4935-88f8-ae9280bc512b-expendables.jpg"},"Title":"The Expendables 3","featured_actors":" Sylvester
Stallone, Jason Statham, Jet Li","genre":"Action, Adventure, Thriller","imdb_rating":6.3,"plot_summary":"Barney augments
his team with new blood for a personal battle: to take down Conrad Stonebanks, the Expendables co-founder and notorious
arms trader who is hell bent on wiping out Barney and every single one of his associates.","running_time_mins":126,"tra
iler_video_link":"http://www.imdb.com/rg/VIDEO_PLAY/LINK//video/imdb/vi1896197145/","viewer_rating":"18","objectId":"8cT
kg769gM","createdAt":"2014-08-16T21:32:28.318Z","updatedAt":"2014-08-16T21:35:56.217Z","__type":"Object","className":"Mo
vie"}]]}
이것은 내 JSON 응답입니다. 배열에서 고유 한 객체를 검색하려고합니다. 보시다시피, 첫 번째 객체의 사본이 마지막에 반환되었습니다. 저는 Underscore.js _.uniq 메소드조차도 많은 솔루션을 시도했습니다. 나는 여전히 적절한 결과를 얻을 수 없었다. 나는 이것에 대한 도움을 주시면 감사하겠습니다. 미리 감사드립니다. 나는 중복 "이미지"당신이 두 번째 내부에 첨부합니다 언급 그래서 난이 JSON 객체를 반복하여 해결책을 발견하고 각각의 첫 번째 요소를 가지고 객체 것으로 나타났습니다json javascript에서 고유 한 객체 배열을 얻으십시오.
Parse.Promise.when(promises).then(
function() {
var result = [];
_.each(arguments, function(object) {
result.push(object); // each object is an array of movieIds
});
var movies = _.flatten(result);
var uniqueMovies = _.uniq(movies, function(movie){
return movie.Title;
});
response.success(uniqueMovies);
},
function(error) {
response.error(error);
}
);
///
});
특별히 시도한 것은 무엇입니까? 구체적으로 적절한 결과는 무엇입니까? 또한 사람이 읽을 수 있도록 데이터의 서식을 지정하는 것이 좋습니다. –
코드를 읽을 수 있도록 포맷하십시오. 들여 쓰기와 개행이 필요합니다. – jfriend00