troubleshooting Question

json and c#

Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America asked on
ASP.NETC#JSON
3 Comments1 Solution40 ViewsLast Modified:
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());
ASKER CERTIFIED SOLUTION
Kelvin McDaniel
Owner

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros