jsonlint
jsonlint copied to clipboard
Failed to Load. System.ArgumentNullException: Argument cannot be null.
Hello guys here's the full error on my logcat
Failed to Load. System.ArgumentNullException: Argument cannot be null. Parameter name: s at System.IO.StringReader..ctor (System.String s) [0x00000] in
:0 at (wrapper remoting-invoke-with-check) System.IO.StringReader:.ctor (string) at LitJson.JsonReader..ctor (System.String json_text) [0x00000] in :0 at LitJson.JsonMapper.ToWrapper (LitJson.WrapperFactory factory, System.String json) [0x00000] in :0 at LitJson.JsonMapper.ToObject (System.String json) [0x00000] in :0 at StreetUtility.LoadJsonFromStreamingAssets (System.String path_with_extention_under_streaming_assets_folder) [0x00000] in :0 notice.json
Could someone help me please . And here's my code. StreetUtility.cs
string full_path = Path.Combine(Application.streamingAssetsPath,
path_with_extention_under_streaming_assets_folder);
string result;
if (full_path.Contains("://") || full_path.Contains(":///"))
{
WWW www = new WWW(full_path);
while (!www.isDone) { }
result = www.text;
}
else
{
result = File.ReadAllText(full_path);
}
Debug.Log("Loaded file: " + result);
JsonData itemData = JsonMapper.ToObject(json);
and here is my LocalizationManager.cs
string json = StreetUtility.LoadJsonFromStreamingAssets("notice.json");
if (json != null)
{
LitJson.JsonData data = LitJson.JsonMapper.ToObject(json);
json = data[language.ToString()].ToJson();
Debug.LogError("PK DEBUG on Language.toString() : " + json.ToString());
notice = LitJson.JsonMapper.ToObject<string[]>(json);
Debug.LogError("PK DEBUG on Notice.toString : " + notice.ToString());
And here's my json file
{ "EN": [ "Cancel is available with Cancel button.", "If you succeed in a lottery, you can receive additional rewards.", "Round 2 and 3 are shorter than you think.", "Please check the homepage in Confirm Game Method and Change Member Information." ], "KR": [ "Cancel 버튼으로 배팅 취소가 가능합니다.", "로또에 성공하면 추가적인 보상을 받을 수 있습니다.", "라운드 2와 3은 생각보다 시간이 짧습니다.", "게임 방법 확인 및 회원정보 변경은 홈페이지에서 확인해주세요." ], "CN": [ "[中文] Cancel is available with Cancel button.", "[中文] If you succeed in a lottery, you can receive additional rewards.", "[中文] Round 2 and 3 are shorter than you think.", "[中文] Please check the homepage in Confirm Game Method and Change Member Information." ], "HK": [ "[广东话] Cancel is available with Cancel button.", "[广东话] If you succeed in a lottery, you can receive additional rewards.", "[广东话] Round 2 and 3 are shorter than you think.", "[广东话] Please check the homepage in Confirm Game Method and Change Member Information." ] }
Please can someone help me please.