Skip to content

Instantly share code, notes, and snippets.

@margusmartsepp
Created September 16, 2014 10:50
Show Gist options
  • Select an option

  • Save margusmartsepp/db0d1fba80c6fc4944f9 to your computer and use it in GitHub Desktop.

Select an option

Save margusmartsepp/db0d1fba80c6fc4944f9 to your computer and use it in GitHub Desktop.
String DeserializeJson
public static class Extensions
{
public static bool DeserializeJson<T>(this String str, out T item)
{
item = default(T);
try
{
item = new JavaScriptSerializer().Deserialize<T>(str);
return true;
}
catch (Exception ex)
{
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment