Open corbinyo opened 4 years ago
When trying to use a Json file served by a url I am getting the error
JsonException: Invalid character '' in input string it happens when I use this method:
JsonException: Invalid character '' in input string
IEnumerator GetText() { UnityWebRequest webjson = UnityWebRequest.Get("http://awebsite.com/Art_.json"); yield return webjson.SendWebRequest(); if (webjson.isNetworkError || webjson.isHttpError) { Debug.Log(webjson.error); } else { // The following line is giving me the error: // ItemDatabase_+<GetText>d__3.MoveNext () (at Assets/Version2.0/Scripts/ItemDatabase_.cs:38) itemData = JsonMapper.ToObject(webjson.downloadHandler.text); Debug.Log(itemData); ConstructItemDatabase(); } }
I have tried to use Trim()
Trim()
itemData = JsonMapper.ToObject(webjson.downloadHandler.text.Trim()); But still have the same result.
itemData = JsonMapper.ToObject(webjson.downloadHandler.text.Trim());
When trying to use a Json file served by a url I am getting the error
JsonException: Invalid character '' in input string
it happens when I use this method:I have tried to use
Trim()
itemData = JsonMapper.ToObject(webjson.downloadHandler.text.Trim());
But still have the same result.