c# serialize object as json and print it code example Example: object to json c# using Newtonsoft.Json; var jsonString = JsonConvert.SerializeObject(obj);