Dimaz,
Как-то так:
if (!Array.prototype.filter)
{
Array.prototype.filter = function(fun)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();
var res = new Array();
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this)
{
var val = this[i];
if (fun.call(thisp, val, i, this))
res.push(val);
}
}
return res;
};
}
var data = [{"name":"Dmitry", "lastname":"Ivanov"},{"name":"Dmitry", "lastname":"Petrov"}, {"name":"Dimaz", "lastname":"Petrov"}];
var filtered = data.filter(function (element, index, array)
{
return element.name == "Dmitry";
});
P.S. если юзать jquery, то так:
var arr = jQuery.grep(data , function (element, index) { return element.name == "Dmitry"; });