Newtonsoft.Json.JsonConvert的反序列化的问题

tm474342778 2016-09-13 10:26:27


这边反序列化报错误

哪位大神可以帮忙解决下哈
...全文
520 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
tm474342778 2016-09-13
  • 打赏
  • 举报
回复

报这个错误了
全栈极简 2016-09-13
  • 打赏
  • 举报
回复
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string json = "{\"activity_key\":\"WFR67DAZ\",\"count\":1,\"records\":[{\"amount\":\"0\",\"date_created\":\"1473667433062\",\"item_key\":\"40fen\",\"mw_id\":\"d121ad121asd213132fasd231131fa\",\"uid\":\"13909998888\"}],\"type\": 2 }";

ActivityResult result = JsonConvert.DeserializeObject<ActivityResult>(json);
Console.WriteLine(result.activity_key);
}
}

public class ActivityResult
{
public string activity_key { get; set; }
public int count { get; set; }
public int type { get; set; }
public List<Result> records { get; set; }
}

public class Result
{
public string amount { get; set; }
public string date_created { get; set; }
public string item_key { get; set; }
public string mw_id { get; set; }
public string uid { get; set; }
}
}

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧