Created
September 30, 2015 15:51
-
-
Save gon250/cb0dbeb1162f6e43dff1 to your computer and use it in GitHub Desktop.
Deserialize json example
This file contains hidden or 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 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