c# .net core convert object to json with annotations code example
Example: c# serialize json
using System.Text.Json;
//Serialize
var jsonString = JsonSerializer.Serialize(yourObject);
// Deserialize
var obj = JsonSerializer.Deserialize<YourObject>(stringValue);