IEnumerator Start() { Debug.Log("Starting to fetch data = " + Time.timeSinceLevelLoad); using (WWW www = new WWW(url)) { yield return(www); string myString = www.text; ShootingObj shootObj = ShootingObj.CreateFromJSON(myString); shootObj.CreateFromJSONOverWrite(myString); Debug.Log("num records: " + shootObj.records.Count); allRecords = shootObj.records; } Debug.Log("Finished data fetch data = " + Time.timeSinceLevelLoad); PlotLinesTimeFrame(MakeAListOfAllDatesInRange()); }
ShootingObj ParseJsonFromFile() { //json file path string jsonFilePath = Path.Combine(Application.streamingAssetsPath, "mass_shootings_in_america.json"); if (File.Exists(jsonFilePath)) { // Read the json from the file into a string string dataAsJson = File.ReadAllText(jsonFilePath); ShootingObj shoooootOBJ = ShootingObj.CreateFromJSON(dataAsJson); return(shoooootOBJ); } else { Debug.LogError("Cannot load json data!"); } return(null); }