Hello and happy new years to all I try to get the information of json but i have a problem, the array "listNiveauArray" is null. the string "contentJsonListNiveau" is correctly completed, I verified with debug.log. I alredy used correctly JsonHelper with another script. Thanks to your answer. Code (CSharp): contentJsonListNiveau = File.ReadAllText(getScriptDisplayActivity.pathJson + cutName[0] +".json"); ListNiveauClass[] listNiveauArray = JsonHelper.FromJson<ListNiveauClass>(contentJsonListNiveau); Debug.Log(listNiveauArray); Code (CSharp): public class ListNiveauClass { public int Niveau; public string Goal; public int Succes; } public static class JsonHelper { public static T[] FromJson<T>(string json) { Wrapper<T> wrapper = JsonUtility.FromJson<Wrapper<T>>(json); return wrapper.Item; } public static string ToJson<T>(T[] array) { Wrapper<T> wrapper = new Wrapper<T>(); wrapper.Item = array; return JsonUtility.ToJson(wrapper); } public static string ToJson<T>(T[] array, bool prettyPrint) { Wrapper<T> wrapper = new Wrapper<T>(); wrapper.Item = array; return JsonUtility.ToJson(wrapper, prettyPrint); } [Serializable] private class Wrapper<T> { public T[] Item; } } And the json Code (JavaScript): { "Item": [ { "Niveau" : 1, "Goal" : "Ffffffffffffff", "Succes" : 0 }, { "Niveau" : 2, "Goal" : "Ffffffffff", "Succes" : 0 } ] }
Résolved I forget Serializable Code (CSharp): [COLOR=#ff0000][Serializable][/COLOR] public class ListNiveauClass { public int Niveau; public string Goal; public int Succes; }