I'll cut to the chase, I'm pulling JSON down over an HTTP request... it's already in a string. All I want to do is parse that JSON into some kind of collection. Array, List, doesn't matter for my purposes. The JSON formatting is my choice coming off of my server, I can use a different format but I want to try to stick with JSON. However, there doesn't seem to be any library for this...........? In PHP I can take an array and just make it into JSON. It's one line. So, what gives? Is there any rational way to do this?
The official Newtonsoft JSON package will not work on iOS, WebGL, Android, WebPlayer, Windows Store (from within Unity), etc. If you need JSON .NET you'd need to use my port however it sounds like you may have a very simple scenario so it might be overkill and you'd get by with something like JsonFX, miniJSON or JsonObject.
Yeah, I'm just transmitting two related fields in pairs. What's funny is it got me thinking... unless there are nested objects involved, JSON and XML are overkill, because you just need a delimiter to split the objects and a delimiter to split the fields.
Very true. In fact you could use a Tuple and do it generically. Or just separate them with a bar character or something.
We have built-in JSON serialisation and deserialisation support on the way, but not until December at the earliest.
I saw that. It'll be interesting how robust it was. It looks like it's associated with the web request support. I'm guessing it probably won't handle any complex scenarios like polymorphism and selective serialization / deserialization via converters and attributes. One thing I can recommend to you guys is to be very mindful with your stripping. I'm getting tons of bug reports since Unity 5.1 in Android and iOS (still working on putting some repro projects together), but the majority of them seem to be because setters on properties are getting stripped so the properties still exist but just the setters are gone and aren't located via reflection.
...right there, that's why I try to do things as simple as possible. Never know when something will just "not work".