Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
.NET7 Web API 中的 JSON 多态序列化
NET7 包括许多改进System Text Json序列化器 其中之一是使用新的类型的多态序列化 JsonPolymorphic 属性 我正在尝试在我的 Asp Net Web API 中使用它 但是尽管模型已正确设置 但它似乎并未序列化
c
json
ASPNETCore
systemtextjson
net70
JsonSerializer.Deserialize 失败
考虑代码 using System using System Text Json public class Program public static void Main int id 9 string str id id var u Js
c
aspnetcoremvc
netcore31
systemtextjson
.Net Core 3.0 JsonSerializer填充现有对象
我正在准备从 ASP NET Core 2 2 迁移到 3 0 由于我不使用更高级的 JSON 功能 但可能如下所述 并且 3 0 现在附带了一个内置的 JSON 命名空间 类 System Text Json 我决定看看是否可以放弃之前的
c
ASPNETCore
razorpages
aspnetcore30
systemtextjson
使用 System.Text.Json 序列化记录成员
我在记录中使用自我引用成员 如下所示 type Payload Id Guid member x DerivedProperty Derived Property using id x Id NewtonSoft Json会序列化这个 但是
json
F
jsonnet
systemtextjson
使用 System.Text.Json.Serialization.JsonConverter 解析 JSON 序列化过程中复杂类型的循环引用
有一个复杂类型引用相同类型的对象 有时是同一对象 public class User public string Name get set public int Age get set public User Reference get s
NET
serialization
systemtextjson
JsonSerializer
jsonconverter
.NET Core 3 [JsonIgnore] 请求单个资源时不起作用
在我的 net Core 3 0 API 中 JsonIgnore 属性无法正常工作 我在用着System Text Json 而不是旧的Newtonsoft Json 当我使用返回对象列表的资源时 例如 api Object 对象的序列化
NET
jsonnet
aspnetcore30
systemtextjson
使用 System.Text.Json 进行自定义反序列化
我的项目中有一个 JSON 字符串 例如 来自 API 调用 我也先搜索 但没有找到符合我情况的 property property 1 1 property 2 true property 3 property 3 1 11 proper
c
NetCore
systemtextjson
如何配置两个 JSON 序列化器并根据路由选择正确的一个
我有一个使用 Net Framework 4 7 的 ASP NET Core Web API 项目 我正在升级到 Net Core 3 1 我升级的原因之一是使用新的 System Text Json 序列化程序 目前 我有一些基于路线的
c
NET
ASPNETCore
jsonnet
systemtextjson
我可以使用 System.Text.Json 通过私有构造函数反序列化 Json 吗?
想知道是否可以拥有私有构造函数并使用新的 System Text Json 序列化器 public class MyModel public string Name get set public string Data get set pr
c
NetCore
systemtextjson
System.Text.Json 中的 DefaultContractResolver 等效项
我正在从 Newtonsoft 转换一些逻辑 并找到以下实现之一 public class CustomDataContractResolver DefaultContractResolver public Dictionary
c
jsonnet
netcore31
systemtextjson
使用 System.Text.Json 自定义可选属性的 JSON 序列化器
我正在尝试实现一个处理两者的 JSON 序列化机制null和缺失的 JSON 值 以便能够在需要时执行部分更新 这样当值缺失时它不会触及数据库中的字段 但当值显式设置为时它会清除它 null 我创建了一个从 Roslyn 复制的自定义结构O
c
json
NetCore
systemtextjson
使用 System.Text.Json 反序列化匿名类型
我正在更新 NET Core 3 x 的一些应用程序 作为其中的一部分 我正在尝试从Json NET到新的System Text Json类 使用 Json NET 我可以反序列化匿名类型 如下所示 var token JsonConver
c
json
NetCore
systemtextjson
netcore31
使用新的 Net Core 3.0 Json 忽略 null 属性
在 ASP Net Core 2 2 中使用 JSON Net 时 当序列化为 JSON 时 我能够忽略值为 null 的属性 JsonProperty NullValueHandling NullValueHandling Ignore
json
jsonnet
aspnetcore30
netcore30
systemtextjson
(de)使用 System.Text.Json 序列化流
我正在尝试使用将对象序列化为 MemoryStreamSystem Text Json JsonSerializer 我无法在文档中找到其实现 方法 有人可以分享使用 System Text Json 进行序列化和反序列化的示例实现吗 UP
aspnet
NET
jsondeserialization
JsonSerializer
systemtextjson
使用字典 System.Text.Json 将 json 反序列化为对象
我正在开发一个 Net 6 0 项目 我想从 Newtonsoft Json 迁移到 System Text Json 到目前为止 除了以下内容之外 大多数都可以正常工作 我有这个 json Key ValidateRequired Loc
c
jsonnet
systemtextjson
aspnetcore60
使用 TryGetProperty 时忽略大小写
我有一个 JsonElement 类型的对象 其中包含 API 返回的数据 我想获取某个属性的值 但问题是 TryGetProperty 区分大小写 有没有办法或解决方法可以按名称获取属性 同时忽略大小写 谢谢 EnumerateObjec
c
ASPNETCore
systemtextjson
当属性丢失时,如何强制 System.Text.Json 序列化程序抛出异常?
Json NET 行为可以通过属性定义 如果 json 负载不包含必需的属性 则使用默认值或仅抛出异常 Yet System Text Json序列化器默默地什么也不做 正在上课 public sealed class Foo Requir
c
json
NetCore
Exception
systemtextjson
如何使用 System.Text.Json 处理可为 null 的引用类型?
我已将项目升级到 net core 3 0 并且正在重构项目以使用新的可为空引用类型功能 但由于以下问题很快就陷入困境 假设我使用一个 REST api 它返回以下 JSON Name Volvo 240 Year 1989 此 api 始
json
netcore30
nullablereferencetypes
systemtextjson
System.Text.Json 中 Newtonsoft.Json 的 JsonProperty 属性的等效项是什么?
Newtonsoft Json 的等价物是什么JsonPropertySystem Text Json 中的属性 Example using Newtonsoft Json public class Example JsonProperty
c
json
jsonnet
systemtextjson
将一种方法迁移到 System.Text.Json
我在 net core 3 1 中添加了 NewtonsoftJson 作为中间件 我很乐意转向新的 System Text Json 序列化器 我不能直接跳过 但有没有办法以一种方法使用 System Text Json 中的一个 或多或
c
json
NetCore
systemtextjson
1
2
3
»