c# classes to json code example
Example 1: c# object to json string
Newtonsoft.Json.JsonConvert.SerializeObject(new {foo = "bar"})
Example 2: c# convert object to json
var jsonString = JsonConvert.SerializeObject(ObjectModel);
Newtonsoft.Json.JsonConvert.SerializeObject(new {foo = "bar"})
var jsonString = JsonConvert.SerializeObject(ObjectModel);