Skip to main content

Posts

Showing posts with the label convert json to string

Convert object to JSON C# NewtonSoft

In this post, we are going to learn how we can convert an object into JSON string in c#. Let's explore the below examples - Use the quickest method of converting between JSON and.NET object is using.Net Inbuilt class JsonSerializer . High performance, faster than .NET's built-in JSON serializes - System.Web.Script.Serialization.JavaScriptSerializer jsSerializerObj = new JavaScriptSerializer(); User = new  User             {                 ID  = "100023" ,                  Age = "29" ,                 FirstName = "Anil" ,                 LastName = "Singh"             }; string json = jsSerializerOb...