C# by Nélio

JSON Serialization in C#

The JsonSerializer.Serialize converts the value of a specified type into a JSON string.

using System.Text.Json;

var user = new User("Krish Jackon", "female", new MyDate(1985, 03, 30));

var json = JsonSerializer.Serialize(user);
Console.WriteLine(json);

Comments