- Home /
JsonUtility.FromJson<>() giving unexpected result
TLS Allocator ALLOC_TEMP_THREAD, underlying allocator ALLOC_TEMP_THREAD has unfreed allocations
is the error that's being thrown anytime i call this method, also getting error: ArgumentException: JSON must represent an object type. and would like to get any further information on why i am getting this error, also i am new to using JSON. Making a HTTP request, getting the data back, debugging the data it looks correct then attempting to deserialize the data and getting this error.
Answer by superpig · Jan 06, 2016 at 02:40 AM
The allocator error message was a bug in 5.3.0 that would happen when the JSON was invalid. It's fixed in 5.3.1.
The 'must represent an object type' error is what you get when the root node of the JSON is not an object - i.e. the JSON data must always be wrapped in { and }, you can't feed things like arrays directly to JsonUtility (yet).
Answer by Clowne · Dec 13, 2015 at 03:53 PM
I'm also getting this and also using the new Unity 5.3 FromJson<>() feature
I'm pretty sure my Json file is fine and everything seems to have loaded correctly. In fact other than knowing its spewing the message to my console everything is working fine. I don't think it's actually allocated more, it just seems to be rather insistent on telling me that it didn't clean up properly.
I know that doesn't really help you, but I'm really just posting to let you know others are also getting this new issue so I'm sure there will be a solution along shortly.
Note: I was only ever actually seeing the first part "TLS Allocator ALLOC_TE$$anonymous$$P_THREAD, underlying allocator ALLOC_TE$$anonymous$$P_THREAD has unfreed allocations"
It is no longer happening now. I tend not to reboot my PC very often. We're told to leave them on overnight so that IT dept can update software etc. So it's just possible that my problem may have been due to not rebooting properly after upgrading to Unity 5.3.
I hope you've solved your issue/s.
Answer by Ranter1337 · Dec 16, 2015 at 08:34 AM
It seems my JSON file was incorrect that seemed to be the issue
I think that was also my issue, but I'd parsed my json in an online json checker and the data was loaded correctly.
Unity development $$anonymous$$m, if you see this comment please could you add a debug option of some sort so it will more easily highlight where your Json reader reader doesn't like the data. Thanks.