Remove Duplicate Fields of JSON

Made with underscore.js

by Gabriel Correa

HTML

<script src="http://underscorejs.org/underscore-min.js"></script>

JavaScript

var myArray = [
    {name:"Bob",b:"text2",c:true},
    {name:"Tom",b:"text2",c:true},
    {name:"Adam",b:"text2",c:true},
    {name:"Tom",b:"text2",c:true},
    {name:"Bob",b:"text2",c:true}
];

console.dir(
    _.uniq(myArray, _.property('name'))
);
console.dir(
    _.uniq(myArray, 'name')
);