Skip to content

Instantly share code, notes, and snippets.

@imwower
Created April 28, 2014 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imwower/11375800 to your computer and use it in GitHub Desktop.
Save imwower/11375800 to your computer and use it in GitHub Desktop.
newtonsoft.json deserializer for restsharp
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