【json】JsonFX

来源:互联网 发布:共享经济 知乎 编辑:程序博客网 时间:2024/05/19 20:46

JsonFX官网:http://www.jsonfx.net/

JsonFX开源地址:https://github.com/jsonfx/jsonfx

JsonFX for Unity:https://bitbucket.org/TowerOfBricks/jsonfx-for-unity3d-git


JsonFX:是一个 .NET 的 JSON 序列化器,提供统一的接口用于读写 JSON、BSON、XML 和 JsonML ,还支持自定义类的序列化。

JsonFX for Unity:由PathFinding项目组对开源JsonFX在Unity中的应用进行的改装,功能和JsonFX基本相似,略有差异,并且支持垮平台。 相比其他json库:.net自带的库臃肿、LitJson不能垮平台、MiniJson不支持自定义类序列化。JsonFX或JsonFX for Unity直接导入Unity应该会有异常,需要自己稍微处理下。

Serialization Features:(JsonFX的特性,JsonFX For Untiy还没细测过)

  • 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

自定义json格式大体如下:

默认模式不用添加任何标签,添加[JsonOptIn]后,需要输出的都需要使用[JsonMember]标签


中文编码问题:


存储读取json文件:




Json Convert扩展:




编辑json工具推荐:NodePad++,需要json相关的插件。



才接触JsonFX,很多细节和其他的还不清楚,希望有兴趣和疑问的可以交流!

1 0
原创粉丝点击