public interface IDetails {}
public class Details : IDetails
public string Name {get; set;}
public int Id {get; set;}
public static IDetails GenerateDetails(string name, int id)
public static void Main()
var x = GenerateDetails("Tyler", 123456);
Console.WriteLine(x.ToString());
var str = JsonConvert.SerializeObject(x);
var actualObj = JsonConvert.DeserializeObject<Details>(str);
Console.WriteLine(actualObj);
Console.WriteLine(actualObj.Name);
Console.WriteLine(actualObj.Id);