RestSharp client returns all properties as null when deserializing JSON response RestSharp client returns all properties as null when deserializing JSON response json json

RestSharp client returns all properties as null when deserializing JSON response


What is the Content-Type in the response? If not a standard content type like "application/json", etc. then RestSharp won't understand which deserializer to use. If it is in fact a content type not "understood" by RestSharp (you can verify by inspecting the Accept sent in the request), then you can solve this by doing:

client.AddHandler("my_custom_type", new JsonDeserializer());

EDIT:

Ok, sorry, looking at the JSON again, you need something like:

public class LocationResponse   public LocationResult Result { get; set; }}public class LocationResult {  public Location Location { get; set; }}

And then do:

client.Execute<LocationResponse>(request);