json字符串反序列化

wanbolantian wanbolantian 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
这是调用某宝接口返回的json字符串:
{"tmall_msf_identify_status_query_response":{"result":"{errorMessage=服务类型不对, gmtCurrentTime=1469153603575, errorCode=352, class=com.tmall.msf.common.dto.Result, object=null, success=false, costTime=null}","request_id":"3jvhmoxlvkco"}}

我试图用newtonjson的DeserializeObject方法,将其反序列化成.net对像,为此我建立了两个类
 public  class result
{
public string errorMessage { get; set; }
public long gmtCurrentTime { get; set; }
public int errorCode { get; set; }
public string @class { get; set; }
public object @object { get; set; }
public bool success { get; set; }
public object costTime { get; set; }
}

public class tmall_msf_identify_status_query_response
{
public result result { get; set; }
public string request_id { get; set; }
}

但发现反序列化后得到的obj总是null值
 tmall_msf_identify_status_query_response obj = JsonConvert.DeserializeObject<tmall_msf_identify_status_query_response>(json);

我该如何反序列化才能得到正确的结果?
...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
wanbolantian
C# 111,128 成员 642,536 内容