SaladLab / Json.Net.Unity3D

Forked Newtonsoft.Json to support Unity3D
MIT License
918 stars 169 forks source link

Getting Unable to find a constructor error in WebGL #35

Open falkartis opened 5 years ago

falkartis commented 5 years ago

I'm trying to De-serialize JSON string I'm getting from a web-service. When I run the code in the Unity editor everything works fine, but when I make a WebGL build and I run it on a browser I'm getting this error.

Unable to find a constructor to use for type {0}. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute.

I found it in the CreateNewObject method inside the JsonSerializerInternalReader class. I tried adding the [JsonConstructor] decorator to an empty/default constructor of my classes, but nothing changes.

sidhants commented 4 years ago

@falkartis @veblush any luck with this? I am stuck with the same issue on an il2cpp build for android.