相关疑难解决方法(0)

如何使用 System.Text.Json 忽略错误值

我正在从.NET Core 3.0 应用程序迁移Newtonsoft.Json到System.Text.Json。我试图忽略错误值。

在System.Text.Json我找到了忽略空值的选项:

JsonSerializerOptions.IgnoreNullValues = true;
Run Code Online (Sandbox Code Playgroud)

但是我找不到忽略System.Text.Json.

有人知道如何做到这一点System.Text.Json吗?

或者,如果有人知道相当于 Newtonsoft 的DefaultValueHandling = DefaultValueHandling.Ignore选项,那也太棒了。

c# json json.net .net-core system.text.json

6
推荐指数
1
解决办法
2976
查看次数

标签 统计

.net-core ×1

c# ×1

json ×1

json.net ×1

system.text.json ×1