How to configure ASP.NET Core to handle circular references without breaking the body's response?
问题 I have this ASP.NET Core 2.0 MVC Controller: [Route("api/[controller]")] public class SampleDataController : Controller { [HttpGet("[action]")] public Example Demo() { return new Example("test"); } public class Example { public Example(string name) { Name = name; } public string Name { get; } public IEnumerable<Example> Demos { get { yield return this; } } } } When querying /api/SampleData/Demo , I get as response body: {"name":"test","demos":[ ...which is obviously very broken JSON-like