cost 301 ms
枚举响应是数值而不是字符串 - Enum response is numeric value and not string

对于我所有其他枚举类 swagger 显示字符串定义,但对于我在“ExceptionMiddleware”class 中使用的一个枚举 class,它显示数值。 但在 swagger 文档示例中,它显示了字符串值.. 我的枚举 class: 我的其他枚举类之一没有这个“问题”: 找不到合约时的结果 ...

JsonSerializer.DeserializeAsync<t> 没有错误,没有异常,没有结果</t> - JsonSerializer.DeserializeAsync<T> no error, no exception, no result

在 my.NET MAUI 应用程序中,我正在反序列化 http 响应: 在这种特殊情况下,T 是 List 的类型,例如: 我有来自服务器的响应,结果是 200,响应中有内容,但是当行var result = await JsonSerializer.DeserializeAsync(stream ...

System.Text.Json.JsonException:JSON 值无法转换为 System.Collections.Generic.List`1[System.Collections.Generic.List`1 - System.Text.Json.JsonException: The JSON value could not be converted to System.Collections.Generic.List`1[System.Collections.Generic.List`1

我是 C# 开发的初学者,我需要你的帮助。我正在检查 Stackoverflow 中的所有主题,但找不到并解决我的问题。 我收到一个 API 的 JSON 响应,我想转换 object 中的数据。 ----------这里是我的 JSON 回复: ----------如果我用 JObject. ...

为什么我的 JSON 序列化程序在将属性从 byte[] 更改为 List 时给出 500 错误<byte[]> ?</byte[]> - Why is my JSON serializer giving a 500 error when changing property from byte[] to List<byte[]>?

我使用纯 JSON 输入和 Base64 编码图像上传图像。 当我使用 byte[] 类型的属性时,代码运行良好但是当我想在一个 go 中支持上传多个文件并将属性更改为 List&lt;byte[]&gt; 时,我得到如下 500 错误 我假设问题出在我的序列化程序方法中,如下所示 序列化器应用于 ...

如何使用 Active-record-serializer 编写自定义 JSON 数据 - How do I use Active-record-serializer to compose custom JSON data

我有以下模型和序列化器。 我想要这样一种情况,当我向我的 List Controller index发出请求时,我得到Expected Json 。 请看下面: 在这里查看我的数据库关联图预计JSON 楷模 序列化器 我已经描述了我上面的尝试。 ...

使用 System.Text.Json 时,将 JSONElement 数组反序列化回具体列表不起作用 - Deserializing array of JSONElement back to a concrete list not working when using System.Text.Json

反序列化对象时遇到问题。 该对象有一个属性( data ),它是一个JSONElement列表。 我正在做: 序列化result变量具有以下内容: 而MyItem类如下: data变量是一个包含x项的列表。 但是,所有项目都是空实例。 我究竟做错了什么? ...

我正在尝试获取要传递到屏幕的对象列表,但我不断收到类型转换错误 - I am trying to get a list of objects to pass to my screen, but I keep getting a type cast error

这是我的Product类别: 我返回产品列表的功能是 我正在尝试从远程 API 解析数据,然后将 JSON 数据转换为产品列表。 我一直收到错误 [错误:flutter/runtime/dart_vm_initializer.cc(41)] 未处理的异常:类型“String”不是类型转换中类型“in ...

我可以配置 asp.net 以便将一些响应序列化为驼峰命名法,而一些响应序列化为 PascalCase 命名法吗? - Can I configure asp.net so some responses are serialized as camelCase and some as PascalCase?

我有一个 API,有两个客户端:OldClient 和 newClient。 我目前在Startup.cs中有这个,所以我的 json 响应被序列化为 PascalCase,即根据我所有的首字母大写的 .net 对象。 OldClient 喜欢这种格式。 但是,newClient 确实更喜欢驼峰 ...

JsonResult object 到 JObject - JsonResult object to JObject

我发现了一个问题,我很感兴趣从JsonResult object 和JObject创建的最佳解决方案是什么。 JsonResult是这样创建的: 它的值在字符串表示中如下所示: 我需要更改其中的一些属性,json,,。 因为它不是有效的 json 字符串,我无法反序列化它。 是否有任何内置库或其 ...

springboot kafka value.serializer = StringSerializer 尽管 producerConfig 和 application.yml 显示否则 - springboot kafka value.serializer = StringSerializer despite producerConfig and the application.yml showing otherwise

我的 Kafka 制作人遇到了麻烦。 出于某种原因,value.serializer 被设置为 StringSerializer,尽管我在 producerConfig 和 application.yml 中都将其设置为 JsonSerializer,如下所示 再次在 application.yml ...

当 JsonSerializerOptions.PropertyNamingPolicy 无效时,如何在 Minimal API 中使用 Results.OK 时设置 JSON PropertyNamingPolicy? - How to Set JSON PropertyNamingPolicy when using Results.OK in Minimal API when JsonSerializerOptions.PropertyNamingPolicy has no effect?

我正在使用 Minimal API 来重新创建旧的 REST 服务,因此我需要尽可能地模仿以前服务的功能。 旧服务中的信息返回 Pascal 大小写,我知道有一些旧客户端是区分大小写的。 开箱即用的 .NET 6 序列化为 web 上的驼峰式外壳,但可以使用以下代码覆盖: 如果设置了断点,我可以看 ...

如何向 JSON 字符串添加缩进以使用 JsonSerializer 修复格式? - How to add indentation to JSON string to fix formatting using JsonSerializer?

web 服务正在向我发送 JSON 字符串。 它包含一个有效的 JSON 字符串,但它的格式很差。 有没有办法可以格式化它以更好地显示在屏幕上? 我希望应用这样的东西: ,但我找不到 API 来做这件事......有什么建议吗? 谢谢。 ...

如何反序列化为基类型的集合,然后将它们转换为具体的类 - How to deserialize into collection of base type and then convert them to the concrete classes

我有一个字符串,我需要将其反序列化为一组对象,所有对象都继承同一个基类。 我的问题是,在我反序列化为基类集合后,编译器不会将每个项目识别为相关的具体对象。 这是我的代码: 还有其他方法吗? ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM