Android json read and write

Hi, i’m having a problem using and Json to store data.

I’m using this methods to read and write an json. They work fine, but in the android build nothing happens.

void Read()
        string path = "Assets/Resources/patients-data.json";

        StreamReader reader = new StreamReader(path);
        string data_text = reader.ReadToEnd();
        PatientData data = JsonUtility.FromJson<PatientData>(data_text);
        patients_data = data;

void SaveData()
        string path = "Assets/Resources/patients-data.json";

        StreamWriter writer = new StreamWriter(path, false);
        string jsonData = JsonUtility.ToJson(patients_data, true);


I tried StreamingAssets to but it failed.

The build, as it should be obvious, does not contain the same directories/ files as the project. You ll need to change the path for any build, not just android, to work. Most common location used is Application.persistentDataPath, but you may use any other directory you want.

You should consider using Android monitor, or any equivalent software, with development build checked to debug android builds or hook the apk to the Editor.