{"id":861,"date":"2017-05-17T13:01:10","date_gmt":"2017-05-17T07:31:10","guid":{"rendered":"https:\/\/blog.binarybits.net\/?p=861"},"modified":"2017-05-17T13:21:02","modified_gmt":"2017-05-17T07:51:02","slug":"remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript","status":"publish","type":"post","link":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/","title":{"rendered":"Remove duplicate list items from SharePoint REST call result using JavaScript"},"content":{"rendered":"

The following code snippet show how to remove duplicate list items in the JSON result of a SharePoint REST call using JavaScript.<\/p>\n

Function Definition:<\/strong><\/p>\n

function RemoveDuplicateItems(items, propertyName) {\r\n    var result = [];\r\n    if (items.length > 0) {\r\n        $.each(items, function (index, item) {\r\n            if ($.inArray(item[propertyName], result) == -1) {\r\n                result.push(item);\r\n            }\r\n        });\r\n    }\r\n    return result;\r\n}<\/pre>\n

Function Usage:<\/strong>
\nIn the below code, assumption is that, the REST call returns data.d.results<\/em> and the column for which duplicate items need to be removed is Title<\/em><\/p>\n

var items = data.d.results;\r\nitems = RemoveDuplicateItems(items, 'Title');<\/pre>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

The following code snippet show how to remove duplicate list items in the JSON result of a SharePoint REST call using JavaScript. Function Definition: function RemoveDuplicateItems(items, propertyName) { var result = []; if (items.length > 0) { $.each(items, function (index, item) { if ($.inArray(item[propertyName], result) == -1) { result.push(item); } }); } return result; } […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[251,62],"tags":[250,243,208],"yoast_head":"\nRemove duplicate list items from SharePoint REST call result using JavaScript : Binary Bits<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Remove duplicate list items from SharePoint REST call result using JavaScript : Binary Bits\" \/>\n<meta property=\"og:description\" content=\"The following code snippet show how to remove duplicate list items in the JSON result of a SharePoint REST call using JavaScript. Function Definition: function RemoveDuplicateItems(items, propertyName) { var result = []; if (items.length > 0) { $.each(items, function (index, item) { if ($.inArray(item[propertyName], result) == -1) { result.push(item); } }); } return result; } […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Binary Bits\" \/>\n<meta property=\"article:published_time\" content=\"2017-05-17T07:31:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-05-17T07:51:02+00:00\" \/>\n<meta name=\"author\" content=\"Kannan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Kannan_B\" \/>\n<meta name=\"twitter:site\" content=\"@Kannan_B\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kannan\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/\"},\"author\":{\"name\":\"Kannan\",\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855\"},\"headline\":\"Remove duplicate list items from SharePoint REST call result using JavaScript\",\"datePublished\":\"2017-05-17T07:31:10+00:00\",\"dateModified\":\"2017-05-17T07:51:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/\"},\"wordCount\":65,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855\"},\"keywords\":[\"CSOM\",\"Javascript\",\"SharePoint\"],\"articleSection\":[\"JavaScript\",\"SharePoint\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/\",\"url\":\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/\",\"name\":\"Remove duplicate list items from SharePoint REST call result using JavaScript : Binary Bits\",\"isPartOf\":{\"@id\":\"https:\/\/blog.binarybits.net\/#website\"},\"datePublished\":\"2017-05-17T07:31:10+00:00\",\"dateModified\":\"2017-05-17T07:51:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.binarybits.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Remove duplicate list items from SharePoint REST call result using JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.binarybits.net\/#website\",\"url\":\"https:\/\/blog.binarybits.net\/\",\"name\":\"Binary Bits\",\"description\":\"Bits & Pieces - A blog by Kannan Balasubramanian\",\"publisher\":{\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.binarybits.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855\",\"name\":\"Kannan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/blog.binarybits.net\/wp-content\/uploads\/2017\/04\/12976869_10207528235497646_1307827709790943986_o.jpg\",\"contentUrl\":\"https:\/\/blog.binarybits.net\/wp-content\/uploads\/2017\/04\/12976869_10207528235497646_1307827709790943986_o.jpg\",\"width\":1270,\"height\":1270,\"caption\":\"Kannan\"},\"logo\":{\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Remove duplicate list items from SharePoint REST call result using JavaScript : Binary Bits","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/","og_locale":"en_GB","og_type":"article","og_title":"Remove duplicate list items from SharePoint REST call result using JavaScript : Binary Bits","og_description":"The following code snippet show how to remove duplicate list items in the JSON result of a SharePoint REST call using JavaScript. Function Definition: function RemoveDuplicateItems(items, propertyName) { var result = []; if (items.length > 0) { $.each(items, function (index, item) { if ($.inArray(item[propertyName], result) == -1) { result.push(item); } }); } return result; } […]","og_url":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/","og_site_name":"Binary Bits","article_published_time":"2017-05-17T07:31:10+00:00","article_modified_time":"2017-05-17T07:51:02+00:00","author":"Kannan","twitter_card":"summary_large_image","twitter_creator":"@Kannan_B","twitter_site":"@Kannan_B","twitter_misc":{"Written by":"Kannan"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/#article","isPartOf":{"@id":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/"},"author":{"name":"Kannan","@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855"},"headline":"Remove duplicate list items from SharePoint REST call result using JavaScript","datePublished":"2017-05-17T07:31:10+00:00","dateModified":"2017-05-17T07:51:02+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/"},"wordCount":65,"commentCount":0,"publisher":{"@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855"},"keywords":["CSOM","Javascript","SharePoint"],"articleSection":["JavaScript","SharePoint"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/","url":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/","name":"Remove duplicate list items from SharePoint REST call result using JavaScript : Binary Bits","isPartOf":{"@id":"https:\/\/blog.binarybits.net\/#website"},"datePublished":"2017-05-17T07:31:10+00:00","dateModified":"2017-05-17T07:51:02+00:00","breadcrumb":{"@id":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.binarybits.net\/remove-duplicate-list-items-from-sharepoint-rest-call-result-using-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.binarybits.net\/"},{"@type":"ListItem","position":2,"name":"Remove duplicate list items from SharePoint REST call result using JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/blog.binarybits.net\/#website","url":"https:\/\/blog.binarybits.net\/","name":"Binary Bits","description":"Bits & Pieces - A blog by Kannan Balasubramanian","publisher":{"@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.binarybits.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855","name":"Kannan","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/image\/","url":"https:\/\/blog.binarybits.net\/wp-content\/uploads\/2017\/04\/12976869_10207528235497646_1307827709790943986_o.jpg","contentUrl":"https:\/\/blog.binarybits.net\/wp-content\/uploads\/2017\/04\/12976869_10207528235497646_1307827709790943986_o.jpg","width":1270,"height":1270,"caption":"Kannan"},"logo":{"@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/posts\/861"}],"collection":[{"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/comments?post=861"}],"version-history":[{"count":5,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/posts\/861\/revisions"}],"predecessor-version":[{"id":866,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/posts\/861\/revisions\/866"}],"wp:attachment":[{"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/media?parent=861"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/categories?post=861"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/tags?post=861"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}