restsharp/RestSharp — Issue #170: Json Deserialization doesn't support arrays
Author: jonnii
Created: 2011-10-19 15:03:01+00:00
State: open

When deserializing an object which has an array of sub items the default json deserializer complains that there's no default constructor (arrays don't have default constructors).

For now I've replaced the json deserializer with this:

public class CustomJsonDeserializer : IDeserializer
{
public T Deserialize(RestResponse response) where T : new()
{
return JsonConvert.DeserializeObject(response.Content);
}

public string RootElement { get; set; }

public string Namespace { get; set; }

public string DateFormat { get; set; }
}

I don't need the date format/namespace/root element stuff. That said, I think the naming convention stuff could use json.net contract resolvers, it might be a cleaner implementation and defer more work to the json.net.