Json.NET 2.0
Date : 2008 03 03 Category : Tech & DevelopmentJames Newton-King has quickly released a new version of Json.NET that has a new easier syntax for querying and and creating JSON.
Creating JSON
PLAIN TEXT JAVASCRIPT:JObject o = JObject.FromObject(new
{
channel = new
{
title = "James Newton-King",
link = "http://james.newtonking.com",
description = "James Newton-King's blog.",
item =
from p in posts
orderby p.Title
select new
{
title = p.Title,
description = p.Description,
link = p.Link,
category = p.Categories
}
}
});
Querying JSON
PLAIN TEXT JAVASCRIPT:var categories =
from c in rss["channel"]["item"].Children()["category"].Values<string>()
group c by c into g
orderby g.Count() descending
select new { Category = g.Key, Count = g.Count() };
