Unity Serializing Nested Dictionary to JSON Unity Serializing Nested Dictionary to JSON json json

Unity Serializing Nested Dictionary to JSON


JsonUtility is the fastest way to use jsons as it doesn't generate almost any GC. The problem is that it isn't very flexible because you need to know in advance the data structure and it cannot be mutated as it needs a class.

If you need to use Jsons as dictionaries you can use either MiniJSON (just right clic and Save As...) or JSONObject, both are free and work in every platform altough they are a lot slower than JsonUtilty, so if you are parsing big jsons or need to do it a lot of times while the performance matters then it isn't going to be fluid.

I personally have used both and they are great, MiniJSON is a bit easier to use while JSONObject is a little bit more potent but also a little bit more difficult to start with.

EDIT:

As mentioned in one of the comments you can also use Newtonsoft, I think it is faster than minijson and jsonobject but might be overkill if you aren't doing a lot of stuff with jsons.