I have an object of student
Class Student
{
public Student()
{
name = "xyz";
roll = 20;
age = 16;
}
string name;
int roll;
int age;
}
Class Service
{
Student student = new Student();
string s = ???
// what I have to do for getting string like {"name" : "xyz", "roll" : 20, "age" :16}
}
I need the string from the above object.
If i serialize the object I am getting something with escape sequences.
Any help would be greatly appreciable.
JsonConvert.SerializeObjectin package Json.NET. Otherwise if you're trying to pretty print something, just use a format string withString.Format.