Currently using LitJson in my development. Json is working perfectly fine in Unity Editor but not in android device. Tried various ways in loading the json file but nothing worked. Here is my latest code:
string path = Application.persistentDataPath + "/Products.json";
string jsonString = File.ReadAllText (path);
if(File.Exists(path)) {
jsonParser data = JsonUtility.FromJson<jsonParser>(jsonString);
data.products.Add (product);
Debug.Log (data.products [1].code);
string jsonString2 = JsonUtility.ToJson (data);
Debug.Log (jsonString2);
File.WriteAllText (path, jsonString2.ToString());
} else{
File.WriteAllText (path, jsonString);
}
Big thanks!