从字符串分层对象访问对象
To Access an Object from string Hierarchical Object
我有一个这样的字符串对象。我尝试使用 newtonsoft json 转换器进行反序列化,但它会导致空对象。我知道这背后的原因是我试图转换成的对象在 "data" 内。因此,它 returns 转换后每个 属性 始终为空。
我想知道如何直接从此对象访问 "data"?
{"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}}
现在,我已经实现了
class VolunteerBackgroundCheckResponse 具有以下属性:
任何人都可以帮助我只从 json 字符串获取数据对象吗?
已解决。为此,我使用了 JObject 并接收了主对象下的所有属性。我访问了 "data" 并反序列化了它。
我有一个这样的字符串对象。我尝试使用 newtonsoft json 转换器进行反序列化,但它会导致空对象。我知道这背后的原因是我试图转换成的对象在 "data" 内。因此,它 returns 转换后每个 属性 始终为空。
我想知道如何直接从此对象访问 "data"?
{"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}}
现在,我已经实现了
class VolunteerBackgroundCheckResponse 具有以下属性:
任何人都可以帮助我只从 json 字符串获取数据对象吗?
已解决。为此,我使用了 JObject 并接收了主对象下的所有属性。我访问了 "data" 并反序列化了它。