How Does This Fit With System.Web.Helpers.Json of WebMatrix

Topics: jQuery
May 17, 2011 at 6:39 PM

I found your stuff and also have been checking out the System.Web.Helpers.Json that's part of WebMatrix: 

They also are doing work along similar lines with serialization/deserialization using the dynamic typing in .NET.

Consider this code, from the WebMatrix FourSquare sample:

public static IList<dynamic> GetFriends(string accessToken, int userId = 0) {
var url = "{0}/friends?oauth_token={1}";
var client = new WebClient();
var jsonResult = client.DownloadString(string.Format(url, userId == 0 ? "self" : userId.ToString(), accessToken));
var result = Json.Decode(jsonResult);
return new List<dynamic>(result.response.friends.items);
Jun 1, 2011 at 7:57 PM

We've chatted with WebMatrix folks about potentially converging on a single type. We've made sure JsonObject can do everything that the WebMatrix type can do. Are there any discrepancies you notice?