title: Remove duplicate on the basis of attribute value
body: <p>I want to remove duplicate array from the response on the basis of the attribute value. If the <code>attribute_value</code> data match with other array attribute value then other should be removed. </p>
  
  <p>logic is very simple. check duplicate attribute_value in each array and remove duplicate array and return
  In response. now you can see the attribute value = 1 is thrice
  and attribute value = 2 is twice</p>
  
  <p>How do i compare and remove whole array if I see attribute value duplicate?</p>
  
  <p>I tried with filter method which seems not working. Please help.</p>
  
  <pre><code>for(var j=0; j&lt;social_post_link.length; j++){
      newFilterarray = social_post_link[j].activity_attributes[0].attribute_value.filter(function(item, index) {
        if (social_post_link[j].activity_attributes[0].attribute_value.indexOf(item) == index){
          return social_post_link;
        }
      });                                             
  }
  </code></pre>
  
  <p>code</p>
  
  <pre><code>[
    {
      "id": "484822",
      "activity_attributes": [
        {
          "id": "868117",
          "activity_id": "484822",
          "attribute_name": "position",
          "attribute_value": "1",
        }
      ]
    },
    {
      "id": "484884",
      "activity_attributes": [
        {
          "id": "868175",
          "activity_id": "484884",
          "attribute_name": "position",
          "attribute_value": "1",
        }
      ]
    },
    {
      "id": "484888",
      "activity_attributes": [
        {
          "id": "868182",
          "activity_id": "484888",
          "attribute_name": "position",
          "attribute_value": "1",
        }
      ]
    },
    {
      "id": "484823",
      "activity_attributes": [
        {
          "id": "868120",
          "activity_id": "484823",
          "attribute_name": "position",
          "attribute_value": "2",
        }
      ]
    },
    {
      "id": "484975",
      "activity_attributes": [
        {
          "id": "868344",
          "attribute_name": "position",
          "attribute_value": "2",
        }
      ]
    },
    {
      "id": "484891",
      "activity_attributes": [
        {
          "id": "868189",
          "attribute_name": "position",
          "attribute_value": "3",
        }
      ]
    },
    {
      "id": "484903",
      "activity_attributes": [
        {
          "id": "868200",
          "attribute_name": "position",
          "attribute_value": "4",
        },
      ]
    }
  ]
  </code></pre>
  
  <p>Desired output</p>
  
  <pre><code>    [
    {
      "id": "484822",
      "activity_attributes": [
        {
          "id": "868117",
          "activity_id": "484822",
          "attribute_name": "position",
          "attribute_value": "1",
        }
      ]
    },
    {
      "id": "484823",
      "activity_attributes": [
        {
          "id": "868120",
          "activity_id": "484823",
          "attribute_name": "position",
          "attribute_value": "2",
        }
      ]
    },
    {
      "id": "484891",
      "activity_attributes": [
        {
          "id": "868189",
          "attribute_name": "position",
          "attribute_value": "3",
        }
      ]
    },
    {
      "id": "484903",
      "activity_attributes": [
        {
          "id": "868200",
          "attribute_name": "position",
          "attribute_value": "4",
        },
      ]
    }
  ]
  </code></pre>