Skip to content

Instantly share code, notes, and snippets.

@manojjsm
Forked from gon250/GetJsonDeserializer.cs
Created October 22, 2015 11:45
Show Gist options
  • Select an option

  • Save manojjsm/5d474b7c2f4a9866b52c to your computer and use it in GitHub Desktop.

Select an option

Save manojjsm/5d474b7c2f4a9866b52c to your computer and use it in GitHub Desktop.
Deserialize json example
public RootObject GetJsonDeserializer(string json)
{
try
{
JsonDataSession = (RootObject)JsonConvert.DeserializeObject(json, typeof(RootObject), new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto,
NullValueHandling = NullValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore,
Error = (serializer, err) =>
{
err.ErrorContext.Handled = true;
}
});
return JsonDataSession;
}
catch (Exception ex)
{
return new RootObject();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment