Skip to content

Instantly share code, notes, and snippets.

@ntotten
Created October 17, 2011 23:45
Show Gist options
  • Select an option

  • Save ntotten/1294220 to your computer and use it in GitHub Desktop.

Select an option

Save ntotten/1294220 to your computer and use it in GitHub Desktop.
using System;
using System.Web.Script.Serialization;
namespace Facebook {
public class FrameworkJsonSerializer : IJsonSerializer {
public string SerializeObject(object obj) {
var serializer = new JavaScriptSerializer();
return serializer.Serialize(obj);
}
public object DeserializeObject(string json, Type type) {
var serializer = new JavaScriptSerializer();
return serializer.Deserialize(json, type);
}
public T DeserializeObject<T>(string json) {
var serializer = new JavaScriptSerializer();
return serializer.Deserialize<T>(json);
}
public object DeserializeObject(string json) {
var serializer = new JavaScriptSerializer();
return serializer.DeserializeObject(json);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment