Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
使用 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
System.Text.Json 如何让转换器利用默认的 Write() 行为
我写了一个系统文本 json自定义转换器Read 自定义转换器的一侧 然而 对于Write 另一方面 我只想使用默认的写入功能来序列化对象 而不必手动进行对象的序列化 我开始于 public override void Write Utf8
c
json
converters
systemtextjson
使用 System.Text.Json 有条件地将对象序列化为单个字符串
我正在用 C 开发 ActivityPub 实现 有时链接是像 url 链接一样的 字符串 有时链接是具有 Link 子类型的对象 链接 实体 我想知道如果一组特定条件为真 只需将一个字符串写入编写器 是否有可能使用 System Text
c
json
systemtextjson
net60
activitypub
使用当前版本的 System.Text.Json.JsonSerializer 序列化 DataSet
您对我们如何做有什么建议吗序列化数据集 数据表 with System Text Json JsonSerializer 目前它抛出此异常 检测到可能的对象循环 但不受支持 这可能是由于循环造成的 也可能是对象深度大于允许的最大深度 64
ASPNETCore
serialization
systemtextjson
ASP.NET Core 3 中是否有使用蛇形命名法作为 JSON 命名策略的内置方法?
我设法使用以下代码让它工作 AddNewtonsoftJson options gt options SerializerSettings ContractResolver new DefaultContractResolver Namin
c
ASPNETCore
NetCore
netcore30
systemtextjson
如何使用 System.Text.Json 将 double[] 二维数组序列化为 JSON?
我需要写一个double 使用 System Text Json 转换为 JSON 文件 但此序列化程序不支持二维数组 我需要一些帮助来转换我的double to a List
c
json
systemtextjson
1
2
3
»