Serialize object into JSON
suggest changeusing Newtonsoft.Json;
var obj = new Person
{
Name = "Joe Smith",
Age = 21
};
var serializedJson = JsonConvert.SerializeObject(obj);
This results in this JSON: {"Name":"Joe Smith","Age":21}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents