Newtonsoft.Json 13.0.2
Json.NET
Json.NET is a popular high-performance JSON framework for .NET
Serialize JSON
Product product = new Product();
product.Name = "Apple";
product.Expiry = new DateTime(2008, 12, 28);
product.Sizes = new string[] { "Small" };
string json = JsonConvert.SerializeObject(product);
// {
// "Name": "Apple",
// "Expiry": "2008-12-28T00:00:00",
// "Sizes": [
// "Small"
// ]
// }
Deserialize JSON
string json = @"{
'Name': 'Bad Boys',
'ReleaseDate': '1995-4-7T00:00:00',
'Genres': [
'Action',
'Comedy'
]
}";
Movie m = JsonConvert.DeserializeObject<Movie>(json);
string name = m.Name;
// Bad Boys
LINQ to JSON
JArray array = new JArray();
array.Add("Manual text");
array.Add(new DateTime(2000, 5, 23));
JObject o = new JObject();
o["MyArray"] = array;
string json = o.ToString();
// {
// "MyArray": [
// "Manual text",
// "2000-05-23T00:00:00"
// ]
// }
Links
Showing the top 20 packages that depend on Newtonsoft.Json.
| Packages | Downloads |
|---|---|
|
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
示例代码:
1.检验字符串是否是Email
bool isEmail="1170397736@qq.com".MatchEmail();
2.获取线程内唯一对象
CallContext<T>.GetData("db");
3.获取当前请求上下文
var context=HttpContext2.Current;
4.获取IP详细地理信息
var address="114.114.114.114".GetPhysicsAddress();
5.大文件操作
FileStream fs = new FileStream(@"D:\boot.vmdk", FileMode.OpenOrCreate, FileAccess.ReadWrite);
{
//fs.CopyToFile(@"D:\1.bak");//同步复制大文件
fs.CopyToFileAsync(@"D:\1.bak");//异步复制大文件
string md5 = fs.GetFileMD5Async().Result;//异步获取文件的MD5
}
6.html的防XSS处理:
string html = @"<link href="/Content/font-awesome/css" rel="stylesheet" />
<!--[if IE 7]>
<link href='/Content/font-awesome-ie7.min.css' rel='stylesheet'/>
<![endif]-->
<script src="/Scripts/modernizr"></script>
<div id="searchBox" role="search">
<form action="/packages" method="get">
<span class="user-actions"><a href="/users/account/LogOff">退出</a></span>
<input name="q" id="searchBoxInput" />
<input id="searchBoxSubmit" type="submit" value="Submit" />
</form>
</div>";
string s = html.HtmlSantinizerStandard();//清理后:<div><span><a href="/users/account/LogOff">退出</a></span></div>
|
3 |
|
Flurl.Http
A fluent, portable, testable HTTP client library that extends Flurl's URL builder chain.
|
3 |
|
Flurl.Http
A fluent, portable, testable HTTP client library.
|
3 |
|
Hyak.Common
Provides infrastructure for common error handling, tracing, configuration, and HTTP/REST-based pipeline manipulation for REST clients generated with Hyak.
|
3 |
|
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
官网教程:https://masuit.com/55
github:https://github.com/ldqk/Masuit.Tools
|
3 |
|
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
官网教程:https://masuit.com/55
github:https://github.com/ldqk/Masuit.Tools
|
3 |
|
Masuit.Tools.Abstractions
Masuit.Tools基础公共库
|
3 |
|
Masuit.Tools.Abstractions
Masuit.Tools基础公共库,包含一些常用的操作类,大都是静态类,加密解密,反射操作,Excel简单导出,权重随机筛选算法,分布式短id,表达式树,linq扩展,文件压缩,多线程下载和FTP客户端,硬件信息,字符串扩展方法,日期时间扩展操作,中国农历,大文件拷贝,图像裁剪,验证码,断点续传,集合扩展等常用封装。
|
3 |
.NET Framework 2.0
- No dependencies.
.NET Framework 3.5
- No dependencies.
.NET Framework 4.0
- No dependencies.
.NET Framework 4.5
- No dependencies.
.NET Standard 1.0
- Microsoft.CSharp (>= 4.3.0)
- NETStandard.Library (>= 1.6.1)
- System.ComponentModel.TypeConverter (>= 4.3.0)
- System.Runtime.Serialization.Primitives (>= 4.3.0)
.NET Standard 1.3
- Microsoft.CSharp (>= 4.3.0)
- NETStandard.Library (>= 1.6.1)
- System.ComponentModel.TypeConverter (>= 4.3.0)
- System.Runtime.Serialization.Formatters (>= 4.3.0)
- System.Runtime.Serialization.Primitives (>= 4.3.0)
- System.Xml.XmlDocument (>= 4.3.0)
.NET 6.0
- No dependencies.
.NET Standard 2.0
- No dependencies.
| Version | Downloads | Last updated |
|---|---|---|
| 13.0.5-beta1 | 3 | 01/11/2026 |
| 13.0.4 | 1 | 01/10/2026 |
| 13.0.3 | 1 | 01/10/2026 |
| 13.0.2 | 2 | 01/10/2026 |
| 13.0.1 | 2 | 01/10/2026 |
| 12.0.3 | 1 | 01/10/2026 |
| 12.0.2 | 1 | 01/10/2026 |
| 12.0.1 | 2 | 01/10/2026 |
| 11.0.2 | 1 | 01/10/2026 |
| 11.0.1 | 2 | 01/10/2026 |
| 10.0.3 | 1 | 01/10/2026 |
| 10.0.2 | 2 | 01/10/2026 |
| 10.0.1 | 2 | 01/10/2026 |
| 9.0.1 | 2 | 01/10/2026 |
| 8.0.3 | 1 | 01/10/2026 |
| 8.0.2 | 1 | 01/10/2026 |
| 8.0.1 | 2 | 01/10/2026 |
| 7.0.1 | 1 | 01/10/2026 |
| 6.0.8 | 1 | 01/10/2026 |
| 6.0.7 | 1 | 01/10/2026 |
| 6.0.6 | 1 | 01/10/2026 |
| 6.0.5 | 1 | 01/10/2026 |
| 6.0.4 | 1 | 01/10/2026 |
| 6.0.3 | 1 | 01/10/2026 |
| 6.0.2 | 1 | 01/10/2026 |
| 6.0.1 | 2 | 01/10/2026 |
| 5.0.8 | 1 | 01/10/2026 |
| 5.0.7 | 1 | 01/10/2026 |
| 5.0.6 | 1 | 01/10/2026 |
| 5.0.5 | 1 | 01/10/2026 |
| 5.0.4 | 1 | 01/10/2026 |
| 5.0.3 | 1 | 01/10/2026 |
| 5.0.2 | 1 | 01/10/2026 |
| 5.0.1 | 1 | 01/10/2026 |
| 4.5.11 | 2 | 01/10/2026 |
| 4.5.10 | 2 | 01/10/2026 |
| 4.5.9 | 1 | 01/10/2026 |
| 4.5.8 | 1 | 01/10/2026 |
| 4.5.7 | 1 | 01/10/2026 |
| 4.5.6 | 1 | 01/10/2026 |
| 4.5.5 | 1 | 01/10/2026 |
| 4.5.4 | 1 | 01/10/2026 |
| 4.5.3 | 1 | 01/10/2026 |
| 4.5.2 | 1 | 01/10/2026 |
| 4.5.1 | 1 | 01/10/2026 |
| 4.0.8 | 1 | 01/10/2026 |
| 4.0.7 | 2 | 01/10/2026 |
| 4.0.6 | 1 | 01/10/2026 |
| 4.0.5 | 1 | 01/10/2026 |
| 4.0.4 | 1 | 01/10/2026 |
| 4.0.3 | 1 | 01/10/2026 |
| 4.0.2 | 1 | 01/10/2026 |
| 4.0.1 | 1 | 01/10/2026 |
| 3.5.8 | 1 | 01/10/2026 |