- Home /
Is there any limitations to deserializing json on webgl?
I'm using the newtonsoft nugat (forced library on us) package to deseralize to my object over a http request, I send out one request get an ID then fire off another to get that info.
This fully works when I run a editor instance but as soon as I build out for webgl I get the issue: Exception has been thrown by the target of an invocation
The issue is second deserialization of my type, it's pulling the request it's just not storing it / setting my object. I'm kind of lost here so any help would be appreciated. I have a feeling it's the newtonsoft package but can't switch to another package to test.
using (var www = UnityEngine.Networking.UnityWebRequest.Get(url))
{
www.SetRequestHeader("Content-Type", "application/json");
var operation = www.SendWebRequest();
while (!operation.isDone)
{
Debug.Log("Waiting");
await Task.Yield();
}
if (www.result != UnityEngine.Networking.UnityWebRequest.Result.Success)
{
Debug.Log("Not successful");
}
var result = Newtonsoft.Json.JsonConvert.DeserializeObject<T>(www.downloadHandler.text);
return result;
}
Your answer
Follow this Question
Related Questions
WebGL and Access-Control-Allow-Origin 1 Answer
How To Separate Json Parameter Function to get values i need ? 0 Answers
Loaclization in WebGL? 1 Answer
Read a string from WebGL build package 1 Answer
Github Pages with WebGL - JSON error 1 Answer