开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 2443|回复: 0

[其它] Newtonsoft.Json

[复制链接]

0

精华

2

贡献

10

赞扬

帖子
7
软币
102
在线时间
3 小时
注册时间
2019-2-25
发表于 2019-2-27 16:45:12 | 显示全部楼层 |阅读模式
Newtonsoft.Json 是一款 .NET 平台中开源的 JSON 序列化和反序列化类库,示例代码:
public class Account{    public string Email { get; set; }    public bool Active { get; set; }    public DateTime CreatedDate { get; set; }    public IList<string> Roles { get; set; }}Account account = new Account{     Email = "james@example.com",     Active = true,     CreatedDate = new DateTime(2013, 1, 20, 0, 0, 0, ateTimeKind.Utc),     Roles = new List<string>     {         "User",         "Admin"    }};string json = JsonConvert.SerializeObject(account, Formatting.Indented);// {//   "Email": "james@example.com",//   "Active": true,//   "CreatedDate": "2013-01-20T00:00:00Z",//   "Roles": [//     "User",//     "Admin"//   ]// }Console.WriteLine(json);

评分

参与人数 2赞扬 +2 收起 理由
wrc + 1
congrui + 1 很给力

查看全部评分

回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-4-30 03:20

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表