Link to home
Start Free TrialLog in
Avatar of Jesper Christensen
Jesper Christensen

asked on

Make class to jSon string

My json string should look like this:
{
"plan":"test",
"name":"test",
"createuser": {
"username":"test",
"usermail":"test",
}
}

How does I build the user class so I can make a json string.
var user = new
{
      plan = "test",
      name= "test",
      createuser ???? {}
};
var jSon = JsonConvert.SerializeObject(user);
ASKER CERTIFIED SOLUTION
Avatar of Nitin Sontakke
Nitin Sontakke
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jesper Christensen
Jesper Christensen

ASKER

Thank you! Which method would you perfer?

your first example, or your last?
First, of course, as I already mentioned in my original comment. Frankly, never used second, so I don't even know if it works with deserialisation.