-
-
Save manojjsm/5d474b7c2f4a9866b52c 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