Suppose I am having one class like -
public class Test
{
public int id { get; set; }
public string name { get; set; }
}
Normal JSON conversion will output like {"id":1,"name":"Souvik"}
If I Put JsonProperty attribute like below in properties, output will be - {"studentId":1,"studentname":"Souvik"}
public class Test
{
[JsonProperty("studentId")]
public int id { get; set; }
[JsonProperty("studentname")]
public string name { get; set; }
}
But I don't want to set this hardcoded name of JsonProperty on id, name property of class and want to set these dynamically. How Can I do that?