JSON-Parser for Unity3D and Flash JSON-Parser for Unity3D and Flash json json

JSON-Parser for Unity3D and Flash


I use LitJSON for Unity and had no problems when I built a web player version for testing purposes a while ago. I have no experience with Flash player but according to this presentation Unity and Flash, the best of both worlds! - Unite presentation slides page 18 ff. it should do the job.


No JSON library written in C# is likely to work with Unity's flash export (if you want strongly typed objects on the client side) because some key .net reflection pieces are not supported, even in the official 4.0 release. I asked Unity to sanction a supported JSON parser that could be used across desktop, web player and flash and it just didn't happen for this release.

I ended up using native AS3 stringify and parse methods on the client side and JSON.net on the server side. The tricky part is compensating for the name mangling that Unity does when it converts your C# to ActionScript. I was able to make this work without hard coding by using some of the standard ways to override parsing and serializing JSON strings, using a lot of describeType(). Since JSON.net is supported in their web player, I was able to use some #if FLASH pragmas to get both working well depending on build target.

So....it is possible, and perhaps I've done much of the hard work for you. If you want some examples let me know.

-Tray Weeds


Try this: https://github.com/ironmagma/jsonparse

It is completly written in UnityScript. Probably it helps and works in Flash Export. But i did not test it.