C# to JSON conversion, dictionary -


i have class follows , want json signature. it's last property actions unsure how transfer json. have tried c# json converter online gives null actions.

 public class notification     {         public string name { get; set; }         public string body { get; set; }         public string subject { get; set; }         public string users { get; set; }         public string date { get; set; }         public list<dictionary<string,dictionary<string,string>>> action { get; set; }     } 

any here appreciated.

the json class be:

{      "name":"test",    "body":"testbody",    "subject":"testsubject",    "users":"testusers",    "date":"9/22/2016 12:26:20 pm",    "action":[         {            "key":{               "innerkey":"value"          }       }    ] } 

for c# code:

var notification = new notification() {     name = "test",     body = "testbody",     subject = "testsubject",     users = "testusers",     date = datetime.now.tostring(),     action = new list<dictionary<string, dictionary<string, string>>>()     {         new dictionary<string, dictionary<string, string>>()         {             { "key", new dictionary<string, string>() { { "innerkey", "value" } } }         }     } }; 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -