Tuesday, February 12th, 2008
LINQ to JSON
<p>James Newton-King has posted a new bit of code called LINQ to JSON which is a .NET LINQ style API over JSON.For example, here is how you could get out categories and how often they are used:
-
-
var categories =
-
from c in rss.PropertyValue<jobject>("channel")
-
.PropertyValue<jarray>("item")
-
.Children<jobject>()
-
.PropertyValues<jarray>("category")
-
.Children<string>()
-
group c by c into g
-
orderby g.Count() descending
-
select new { Category = g.Key, Count = g.Count() };
-
There is also a project, JSLINQ which is an implementation of LINQ to Objects implemented in JavaScript. It is built using a set of extension methods built on top of the JavaScript Array object. If you are using an Array, you can use JSLINQ.
Related Content:











Just to be complete: there’s also PHPLinq on http://codeplex.com/PHPLinq .
One word, EXCELLENT!
Jaql (http://www.jaql.org/) looks like another one.
how about dynamic linq, I think that’s more useful than normal linq
Very cool…. nice to see LINQ crossing the Microsoft chasm.