Generates
Json for specific object instance
/// <summary>
/// Generates Json for
specific object instance
/// </summary>
/// <param name="instance">Instance to be converted to Json </param>
/// <param name="recursionDepth">Recursion depth optional paramter</param>
/// <returns>Json for
specific object instance</returns>
public static string ToJson(this object instance, int
recursionDepth = 100) {
JavaScriptSerializer serializer = new JavaScriptSerializer();
serializer.RecursionLimit = recursionDepth;
return serializer.Serialize(instance);
}
No comments:
Post a Comment