Created
September 26, 2013 09:40
-
-
Save PaulSorensen/6711996 to your computer and use it in GitHub Desktop.
egeek.dk - WCF return JSON, AJAX-enabled WCF Service in less than 3 minutes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class JsonHelper | |
{ | |
public static string ToJson(this object obj) | |
{ | |
var serializer = new JavaScriptSerializer(); | |
return serializer.Serialize(obj); | |
} | |
public static string ToJson(this object obj, int recursionDepth) | |
{ | |
var serializer = new JavaScriptSerializer(); | |
serializer.RecursionLimit = recursionDepth; | |
return serializer.Serialize(obj); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment