Using LitJson in unity3d Using LitJson in unity3d json json

Using LitJson in unity3d


I've been through a bunch of Json libraries in Unity3D. The only one I've found that doesn't have weird serialization/deserialization quirks, and works consistently in iOS, WebPlayer, and Editor is JsonFX JsonSerializer 1.4.

That said, I think your problem is that you have to instantiate a JsonReader before you can use it's methods.

Something like this might work:

var reader = new LitJson.JsonReader();Object a = reader.Read(www.text);

Edit:

Whoops, I skipped part of your question. You should be able to using any managed assembly from UnityScript, just like from C#. Instead of including namespaces with using, you use import. After that the code would be virtually identical to the C# version, except for the way UnityScript defines types (var blah : Type = YadaYada();)


Hm. Have you tried Jayrock? Its code looks OK, but there isn't any documentation to speak of, and the author is satisfied to leave it that way.


About question

  1. if you want to access js code in c# script ,you should place the js code int Plugins folder, and vice versa.

  2. Object a = LitJson.JsonReader.Read(www.text);
    I think JosnReader is not a static class,you should instance a new JsonRead Object and then you can access Read(string data) mehotd