I receive the following alert: Could not determine JSON object type for type System.Collections.Generic.Dictionary`2[System.String, System.String].
do you know why and how to fix it?
I expect to set the result:
{
"action": "cancel",
"registrants": [
{
"id": "1222",
"email": "hello@gmail.com"
}
]
}
var model1 = new Dictionary<string, string>(); model1.Add("id", "1222"); model1.Add("email", "hello@gmail.com"); dynamic test = new JObject(); test.action = "Cancel"; test.registrants = model1; Response.Write(test.ToString());
var model1 = new Dictionary<string, string>(); model1.Add("id", "1222"); model1.Add("email", "hello@gmail.com"); yourObj test = new yourObj(); test.action = "Cancel"; List<Dictionary<string, string>> list = new List<Dictionary<string, string>>(); list.Add(model1); test.registrants = list; Response.Write(JsonConvert.SerializeObject(test));