serialization - 从字符串层次对象访问对象
问题描述
我有一个这样的字符串对象。我曾尝试使用 newtonsoft json 转换器进行反序列化,但它会导致 null 对象。我知道背后的原因是我试图转换为的对象在“数据”中。因此,它在转换后总是为每个属性返回 Null。
我想知道如何直接从这个对象访问“数据”?
{"data":{"providerRef":null,"orderId":"4579144","orderStatus":"x:app_pending","applicantInterfaceURL":"http://google.com","successful":true,"error":null,"reportAddress":null,"correlationId":"55f7022c-28f9-490a-8dd1-b30a40e3467a"},"status":0,"error":{"actionArguments":null,"errorCode":null,"errors":null,"message":null}}
VolunteerBackgroundCheckResponse类具有以下属性:
任何人都可以帮助我仅从 json 字符串中获取数据对象吗?
解决方案
这解决了。我为此目的使用了 JObject,并收到了主对象下的所有属性。我访问了“数据”并将其反序列化。
推荐阅读
- c# - 如何将变量(列表列表)的值添加到列表(列表列表)中而不在 C# 中添加变量本身
- laravel - Laravel 调度器 monthlayAt 工作日组合
- javascript - webpack-dev-server:找不到输出文件 404
- google-apps-script - OnEdit 不会在 Google App 脚本中通过复制和粘贴触发
- python - Python从索引到另一个重复列表值
- c++ - 如何在 C++20 中对模块进行参数化?
- python - 如何拆分大型 XBRL 文件?
- reactjs - 如何解决 react native tls/ssl 网络错误?
- python - 正则表达式解析带有括号嵌套子列表的列表?
- android - 当应用程序离线时,如何保留本地数据库以将数据存储在android应用程序中?