public static class Json { public static string ToJson(this object obj) { JavaScriptSerializer serializer = new JavaScriptSerializer(); return serializer.Serialize(obj); } public static string ToJson(this object obj, int recursionDepth) { JavaScriptSerializer serializer = new JavaScriptSerializer(); serializer.RecursionLimit = recursionDepth; return serializer.Serialize(obj); } public static T FromJson(this object obj) { JavaScriptSerializer serializer = new JavaScriptSerializer(); return serializer.Deserialize (obj as string); } }
Monday, January 30, 2012
Best Extension Methods: JSON
These are best extension methods for JSON
Share This!
Labels:
C#.NET,
Extension Methods
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment