json library for webgl

Hello, I was wondering if anyone has successfully used any JSON mapping libraries on the webgl player. Our app makes heavy use of restful services and we need a fairly robust JSON library.

I have tried both JsonFX, and LitJson(missing complex mapping functionality) so far and I have not been successful, as they cause runtime errors.

Thank you,
Dylan

Dylan -

I have been working on getting JSON .NET compatible with WebGL. I’ll be doing some testing this evening and I can let you know how it goes. WebGL is still very much a beta product so compatibility may fluctuate.

I am also very interested in this, trying to get JSON data to come in but same thing, crashing.

Jason

I posted this in my official release thread but I have been working to get compatibility with WebGL. I have managed to get some serialization and deserialization working but there is still a ways to go.

Do you by chance have an timeframe for when you think you’ll have it compatible? Thanks!

maybe this would work?

Not as of yet because it is dependent on Unity bug fixes in IL2CPP

I have used “Json Magic!” from asset store in my webgl project.
You need to rewrite the classes you want to be serialized and have more work, but at least it works.
The only type I didn’t manage to serialize was Dictionary, but I used LgJsonArray instead.

Good to know. JSON .NET is now working with IL2CPP at least for 64-bit iOS builds and it should be coming in a very near beta so it should be able to support WebPlayer as well.

SimpleJSON (available at simple-json/src/SimpleJson at master · facebook-csharp-sdk/simple-json · GitHub) seems to work well. I’ve been using it with the WebGL export, with no bugs (at least, none caused by SimpleJson!). It’s also easy to integrate (as it’s a single file), has a straightforward API, and is permissively licensed.

That said, my usage of it is somewhat limited. I don’t know the structure of my data, so I haven’t used its reflection capabilities (instead serializing to JsonObjects). I did test them when evaluating the library though, and they seemed to work.