how convert object to json string in c# code example Example: c# object to json string Newtonsoft.Json.JsonConvert.SerializeObject(new {foo = "bar"})