public class Website
{
public string Url { get; set; }
private Website()
{
}
public Website(Website website)
{
if (website == null)
{
throw new ArgumentNullException(nameof(website));
}
Url = website.Url;
}
}
string json = @"{'Url':'http://www.google.com'}";
try
{
JsonConvert.DeserializeObject<Website>(json);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Website website = JsonConvert.DeserializeObject<Website>(json, new JsonSerializerSettings
{
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor
});
Console.WriteLine(website.Url);