Serialize a class to json c# code example
Example: c# serialize json
using System.Text.Json;
//Serialize
var jsonString = JsonSerializer.Serialize(yourObject);
// Deserialize
var obj = JsonSerializer.Deserialize<YourObject>(stringValue);
using System.Text.Json;
//Serialize
var jsonString = JsonSerializer.Serialize(yourObject);
// Deserialize
var obj = JsonSerializer.Deserialize<YourObject>(stringValue);