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
特性
- 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
基础例子:
动态类型的映射 (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]}
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!