Help with Serialize C#

Jan 23, 2015 at 3:07 PM
I have the following that i would like to use JsonConvernt on and Im hoping someone would be able to give me some guidance or sample code to get me going. I can take a simple example and work with it but this is a bit more complex with the nesting and I just cannot seem to get it.
"params" : [
                                 "url" : "sys/login/user",
                                 "data" : [
                                                 "passwd" : "pwd",
                                                 "user" : "username"
"session" : 1,
"id" : 1,
"method" : "exec"
Jan 23, 2015 at 4:26 PM
Remove this from the end of your data
Input rest of your data to Properties.Resource

than use code
 var t1 = JsonConvert.DeserializeObject(Properties.Resources.String1);
It works fine for me
Jan 23, 2015 at 6:54 PM
Thanks for the assist, im thinking i need a bit more :) Ill add some more details.

So i took the above and ran it through json2csharp and it generated me these 3 classes.
public class Datum
            public string passwd { get; set; }
            public string user { get; set; }

        public class Param
            public string url { get; set; }
            public List<Datum> data { get; set; }

        public class RootObject
            public List<Param> @params { get; set; }
            public string session { get; set; }
            public int id { get; set; }
            public string method { get; set; }
I then created this object for testing.
RootObject temp = new RootObject();                        
   = 1;
            temp.method = "exec";
            temp.session = "1";
This works fine when i pass temp to JsonConvert:
string json = JsonConvert.SerializeObject(temp, Formatting.Indented);
Outputting that to a console gives me:
  "params": null,
  "session": "1",
  "id": 1,
  "method": "exec"
I guess my real issue is setting and passing the other needed items to JsonConvert.SerializeObject

I have this working fine in Perl, when encoded using my Perl app i end up with this:
which i am using in an HTTP POST.

Now it is entirely possible I am barking up the completely wrong tree here and going about this completely wrong. I'm really not a programmer but have some need for this stuff moving forward.

Thanks again,