Loading JSON file from streamingAssets on android

Hi there.

I’m trying to load a list of country codes i have stored in the streamingAssets folder. I’m able to load it properly with iOS, but on android, using a WWW request, i am getting a JSON parse error. When I log the contents of the file to the console, i.e. www.text, I see the data gets cut off halfway.

Is this a limitation of the WWW class?

The file is valid json and loads just fine on iOS.

This is the code i’m using to load the file:

public IEnumerator LoadCountryCodes() {
	string filePath = Path.Combine(Application.streamingAssetsPath, "CountryCodes.json");
	string dataAsJson;
	if (filePath.Contains ("://")) {
		WWW www = new WWW (filePath);
		yield return www;
		dataAsJson = www.text;
	} else {
		dataAsJson = File.ReadAllText(filePath); 

	CountryCodes countryCodes = JsonUtility.FromJson<CountryCodes>(dataAsJson);

	if (OnCodesLoadedMethods != null) {
		OnCodesLoadedMethods (countryCodes.codes);

Hey I loaded the file from Resources as a TextAsset and then converted it to JSON, and that worked

public void LoadCountryCodes() {
	TextAsset codesJson = Resources.Load<TextAsset> ("CountryCodes");

	CountryCodes countryCodes = JsonUtility.FromJson<CountryCodes>(codesJson.text);
	Debug.Log ("Country codes loaded: " + countryCodes.codes.Length);
	if (OnCodesLoadedMethods != null) {
		OnCodesLoadedMethods (countryCodes.codes);

Thanks for your help @blue-mile