I haven't run your code but i think the first place to start would be your class that you are trying to deserialize the response to.
I took the URL and got the json from the site itself and your structure doesn't look correct. I used json2csharp.com and got the following as what you should be using when deserializing.
Json
{
"status":"success",
"description":"Data successfully received.",
"data":{
"geo":{
"host":"1.1.1.1",
"ip":"1.1.1.1",
"rdns":"hostname",
"asn":"1111111",
"isp":"ISP",
"country_name":"United States",
"country_code":"US",
"region":"GA",
"city":"Atlanta",
"postal_code":"11111",
"continent_code":"NA",
"latitude":"11.1",
"longitude":"-11.1",
"dma_code":"111",
"area_code":"111",
"timezone":"America\/New_York",
"datetime":"2017-07-25 21:37:30"
}
}
}
Which a matching class to this object would be
public class Geo
{
public string host { get; set; }
public string ip { get; set; }
public string rdns { get; set; }
public string asn { get; set; }
public string isp { get; set; }
public string country_name { get; set; }
public string country_code { get; set; }
public string region { get; set; }
public string city { get; set; }
public string postal_code { get; set; }
public string continent_code { get; set; }
public string latitude { get; set; }
public string longitude { get; set; }
public string dma_code { get; set; }
public string area_code { get; set; }
public string timezone { get; set; }
public string datetime { get; set; }
}
public class Data
{
public Geo geo { get; set; }
}
public class RootObject
{
public string status { get; set; }
public string description { get; set; }
public Data data { get; set; }
}
The class you are using would expect the json returned to simply be
{
"status":"success",
"description":"Data successfully received.",
"host":"1.1.1.1",
"ip":"1.1.1.1",
"rdns":"hostname",
"asn":"1111111",
"isp":"ISP",
"country_name":"United States",
"country_code":"US",
"region":"GA",
"city":"Atlanta",
"postal_code":"11111",
"continent_code":"NA",
"latitude":"11.1",
"longitude":"-11.1",
"dma_code":"111",
"area_code":"111",
"timezone":"America\/New_York",
"datetime":"2017-07-25 21:37:30"
}
and even then, some of the labels you are using in your class don't match the labels that are returned in the json.
But when you deserialize your string to an object instead of
IPData ipdata = JsonConvert.DeserializeObject<IPData>(response);
you would do
RootObject ipdata = JsonConvert.DeserializeObject<RootObject>(response);
So i think if you swap out your IPData with the class structure above, it may work, again I haven't ran your code myself.