Need a JSON parser for Unity3d

后端 未结 2 1592
悲哀的现实
悲哀的现实 2021-01-23 05:55

I need to deserialize some JSON objects. I tried to use Tiny-json library, but it\'s too slow. I tried to use Newtonsoft.Json, but it fails in webplayer with this error:

相关标签:
2条回答
  • 2021-01-23 06:27

    Unity 5.3 added Native support of Json Serializer. It is faster than others.

    JsonUtility.ToJson to convert a class to Json.

    JsonUtility.FromJson to convert Json back to class.

    For complete example and information regarding json arrays, see

    Serialize and Deserialize Json and Json Array in Unity

    0 讨论(0)
  • 2021-01-23 06:38

    You can try one of these open source solutions:

    • https://github.com/jacobdufault/fullserializer
    • https://github.com/mtschoen/JSONObject (https://www.assetstore.unity3d.com/en/#!/content/710) I am using this one most of the times, it's versbose but does its job well, not sure about performance however

    Or go with paid ones:

    • https://www.assetstore.unity3d.com/en/#!/content/11347
    0 讨论(0)
提交回复
热议问题