How to write a TextAsset to disk

I have implemented a JSON structure that stores game related data.
This JSON file is stored in the Resources folder and I read it via TextAsset in this manner:

TextAsset jsonText = (TextAsset)Resources.Load(jsonFileName, typeof(TextAsset));

Now, during the lifetime of the game, this JSON structure may need to be modified and in that case would need to be stored on disk to ensure game play progress is not hampered.

On a device, how would I get the proper path of this TextAsset without using UnityEditor.AssetDatabase.GetAssetPath(jsonText) and then write this TextAsset back to disk?

PS: This needs to work on a device.

You cannot modify a TextAsset in a build. The file structure does not exist. You’ll have to figure out some other method of saving the file. If your build platform supports it, you can use Application.persistentDataPath. I’ve never written anything to it, but you might have write access to the streaming assets folder. If so, that might be a nice place to put the file since you would not need to special case things. I don’t know how big your file is, but PlayerPrefs can store reasonably large files as strings. The size varies by platform, but it is 1mb on Windows.