How to serialize an object to json through setting json field name from object's property value?
I am using NewtonsoftJson as a json library.
public class Data
{
public string Question {get;set;} = "Test Question?";
public string Answer {get;set;} = "5";
}
expected json output:
{
"Test Question?": {
"Answer": "5"
}
}