Saving jSon file to Device .

Initially i Read data from the asset this way ,

public static string ReadDataFromFile ()

	TextAsset asset = Resources.Load ("Files/Levels") as TextAsset;
	string jsonString;
	jsonString = asset.text;
	return jsonString;

and after making some changes i want to save those changes to a file so that when read i can see the changes .

public static void WriteDataToFile (string jsonString)
	string path = Application.dataPath + "/Resources/Files/Levels.json";
	Debug.Log ("AssetPath:" + path);
	File.WriteAllText (path, jsonString);
	UnityEditor.AssetDatabase.Refresh ();


I can see the changes when run in unityEditor but when i run the code on the device the data in the file doesn’t show the changes .
I don’t know what’s wrong in this code.

If you want save and load in devices, you need use Application.persistentDataPath. Resources folder is for read only (The Editor is the exception).

So path now be something like:
string path = Application.dataPath + “Levels.json”;