Unity是否需要LitJson?
Unity是否需要LitJson? 1 首先是Unity内置的JsonUtility无法直接解析Json数组,只能解析最外层是Object的形式比如
这样的直接解析不了,这是最难受的地方
2 解析类型丰富度。第三方可能可以解析DateTime,Dictionary等等更多的类型
3 性能问题。Unity内置的JsonUtility性能不行,网上有对比 估计是因为其他插件使用它。通常我们都适用newtonjson 因为unity本身那套json解析做的不够完善,很多人因为不熟悉,或者用着别扭,又或者不能满足需求,就会用自己偏爱的组件诸如litjson,newtonjson,besthttp的json库等 &#34;The JSON Serializer API supports any MonoBehaviour subclass, ScriptableObject subclass, or plain class or struct with the attribute. When you pass in an object to the standard Unity serializer for processing, the same rules and limitations apply as they do in the Inspector: Unity serializes fields only; and types like Dictionary<> are not supported.
Unity does not support passing other types directly to the API, such as primitive types or arrays. If you need to convert those, wrap them in a class or struct of some sort.&#34;
截取自官方文档。 请使用newtonjson
LitJson有些结构不是天然支持,比如字典,得自己加
页:
[1]