Use LitJson and Json file served from a URL in place of local Json file

150 Views Asked by At

Needing help with a json (LitJson) issue. I am trying to read a json file from the web in the same way as I am able to read a local json file.

the way I read the local file is like this

public JsonData itemData;
itemData = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/StreamingAssets/Art_.json"));

when I debug itemData I get back JsonData array in the console.

I am successfully reading the json file from the web with this:

UnityWebRequest webjson = UnityWebRequest.Get("http://somewebsite.com/Art_.json");

when I debug webjson i get back the entire json file in the console.

I am not sure how the json is being parsed differently, and why I can not replace the locally served json data with the json data being served from the url.

Thank you for any and all help.

0

There are 0 best solutions below