JsonFx v2.0 - 用于.Net應用的JSON序列化框架
JsonFx 是一個 .NET 的 JSON 序列化器,提供統一的接口用于讀寫 JSON、BSON、XML 和 JsonML 。
運行支持:
- .NET Framework 2.0, 3.0, 3.5, and 4.0
- Silverlight 3.0, 4.0
- Windows Phone 7
- Mono Framework 2.6 </ul>
- Unified interface for reading / writing JSON, BSON, XML, JsonML
- Implements true LINQ-to-JSON (not simply LINQ-to-Objects over JSON types)
- Naturally deserializes to standard CLR types, not JSON/XML-specific types
- Supports reading/writing POCO classes
- Supports reading/writing using DataContract, XmlSerialization, JsonName, attributes
- Supports reading/writing using convention-based property renaming
- Supports reading/writing C# 4.0 dynamic types
- Supports reading/writing C# 3.0 Anonymous objects
- Supports reading/writing LINQ queries
- Supports custom reading/writing extensions & name resolution strategies
- Dependency-injection-friendly for extremely flexible custom configurations
- Stream-based serialization for reading/writing right off the wire
- Provider allows automatic selection of serializer from Content-Type and Accept-Types HTTP headers </ul>
特性
基礎例子:
動態類型的映射 (default for .NET 4.0):
var reader = new JsonReader(); var writer = new JsonWriter();
string input = @"{ ""foo"": true, ""array"": [ 42, false, ""Hello!"", null ] }";
dynamic output = reader.Read(input);
Console.WriteLine(output.array[0]); // 42
string json = writer.Write(output);
Console.WriteLine(json); // {"foo":true,"array":[42,false,"Hello!",null]}</pre></code>
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!