Created
April 28, 2014 15:40
-
-
Save imwower/11375800 to your computer and use it in GitHub Desktop.
newtonsoft.json deserializer for restsharp
This file contains 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 class RestSharpJsonDeserializer : IDeserializer | |
{ | |
private static JsonSerializerSettings jsonSettings = new JsonSerializerSettings | |
{ | |
NullValueHandling = NullValueHandling.Ignore, | |
DefaultValueHandling = DefaultValueHandling.Ignore | |
}; | |
public string DateFormat { get; set; } | |
public string Namespace { get; set; } | |
public string RootElement { get; set; } | |
public T Deserialize<T>(IRestResponse response) | |
{ | |
return JsonConvert.DeserializeObject<T>(response.Content, jsonSettings); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment