This is actually a very good idea. You could do something like this
Array.prototype.Where = function(filterFn){ var i, results = []; for (i = 0; i < this.length; ++i){ if (filterFn.call(this, this[i])){ results.push(this[i]); } } return results; };
Then it would make sure that every array in your json would have a Where method, which you can use for filtering (just like linq).
source share