I have 2 entities that are related as one to many
public class Restaurant { public int RestaurantId {get;set;} public string Name {get;set;} public
This worked using System.Text.Json
var options = new JsonSerializerOptions() { MaxDepth = 0, IgnoreNullValues = true, IgnoreReadOnlyProperties = true };
Using options to serialize
objstr = JsonSerializer.Serialize(obj,options);