Advertisement

UnityWebRequest result can't be deserialized to JSON

Started by January 21, 2018 02:57 PM
11 comments, last by NDraskovic 6 years, 10 months ago

What you can do is using another deserializer than what Unity3D provides.

I hope you can get the result from the reserver as pure text, then you can feed it into a library like MiniJSON, instead of working with objects, you are given a dictionary with <string, object>. It has some advantages, like supporting more character in keys, for example:
 


{
   "this#would_not_work_in_unity_deserialiser": "But it works fine with MiniJSON"
}

However, the syntax ond access and update gets a bit uglier, also having all JSON as objects makes it more easy to see the format, just having a dictionary with anything with it is bit harder to debug. No big issue thou.

I have been using MiniJSON successfully myself. Here is a link to what I believe is its official github:

https://gist.github.com/darktable/1411710 

I went and made my own parser, it works fine so far, so I'll be using that, but thanks for the answers, it's going to come in handy later.

This topic is closed to new replies.

Advertisement