add custom deserializer

This commit is contained in:
2013-06-13 14:31:45 +02:00
parent 5ee9b4222c
commit 0b0c83b1c0
+34
View File
@@ -0,0 +1,34 @@
using RestSharp;
using RestSharp.Deserializers;
using ServiceStack.Text;
namespace PocketSharp
{
public class JsonDeserializer : IDeserializer
{
public const string JsonContentType = "application/json";
/// <summary>
/// Deserializes the specified response.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="response">The response.</param>
/// <returns></returns>
public T Deserialize<T>(IRestResponse response)
{
var x = JsonSerializer.DeserializeFromString<T>(response.Content);
return x;
}
public string DateFormat { get; set; }
public string Namespace { get; set; }
public string RootElement { get; set; }
public string ContentType
{
get { return JsonContentType; }
}
}
}