I've traced through the my method (below) at run time. Below the code I've included a screenshot of the Debug examination of the Portfolios list just before the return statement. I've expanded a couple of the list entries. As you can see, each Portfolio object contains bona fide data - a numeric Id and a string name.
Yet, here's what comes back to the Chrome browser, or postman, no difference.
What's happening to all the data? Thanks for your help!
The id and name need to be public and properties. As of 3.0 System.Text.Json.JsonSerializer does not serialize fields.
Add {set;get;}
2.
raw json data as follow:
Add {set;}
.NET 9 AOT发布序列化反序列化报错System.Text.Json
MQTT 发布失败: Reflection-based serialization has been disabled for this application. Either use the source generator APIs or explicitly configure the 'JsonSerializerOptions.TypeInfoResolver' property
.创建源生成器
//加这么一句,每个要用到序列化反序列化的对象都要加
原文链接:https://blog.csdn.net/wushuaihua520/article/details/143952057