Linq.js is a LINQ for javascript. You can do almost everything you do in .NET 4.0. It has two version: linq.js and jquery.linq.js. So you can use it easily with js or jquery. And it has intellisense for Visual Studio.
https://jsfiddle.net/mertcagriberkerhan/yctmfrhx/21/
var jsonArray = [ { "user": { "id": 1, "name": "Damla", "age": 27}}, { "user": { "id": 2, "name": "Çağrı", "age": 30 }}, { "user": { "id": 3, "name": "Mehmet", "age": 28 }}, { "user": { "id": 4, "name": "Mete", "age": 29 }} ] // syntax 1 - anonymous function var queryResult = $.Enumerable.From(jsonArray) .Where(function (x) { return x.user.age < 30 }) .OrderBy(function (x) { return x.user.id }) .Select(function (x) { return x.user.name + ':' + x.user.age }) .ToArray(); // shortcut! string lambda selector var queryResult2 = $.Enumerable.From(jsonArray) .Where("$.user.age < 30") .OrderBy("$.user.id") .Select("$.user.name + ':' + $.user.age") .ToArray(); $("#result").html(queryResult)
İlk Yorumu Siz Yapın