To answer my own question: In Program.cs file I've added:
builder.Services.AddControllers().AddJsonOptions(options => {
options.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.Preserve
});
Also, I've included Emails and Phones Attributes in the Controller:
[HttpGet("{id}")]
public async Task<ActionResult<Contact>> GetOneContact(int id)
{
var contact = await _context.Contacts.Include(c => c.Emails).Include(c => c.Phones).FirstOrDefaultAsync(c => c.Id == id);
if (contact == null) return NotFound();
return contact;
}
In the end, I've added [JsonIgnore] annotation to my Contact attribute in both Phone and Email models.