System.Text.Json serialization against an anonymous object
问题 I'm working on an ASP .Net Core 3.1 application, porting part of the code from another using 2.2. So far, I'd like to switch from the NewtonSoft JSON serialization library to the new one, System.Text.Json, but I have some trouble. Consider a function to serve a HTTP-GET service with this returning type: [HttpGet("myservice")] public async Task<ActionResult<object>> GetDataAsync( ... Then, the final part could be depicted as follows: var items = new List<IMyInterface>(); int totalCount = ...