static void Main(string[] args) { // toto o = new toto(); var o = new ComplexObject(); var test = MyJSON.Serialize(o); Console.WriteLine(); }
public JsonController() { if (_context == null) { MyData = MyJSON.RecieveJSON("https://jsonplaceholder.typicode.com/posts"); _context = JsonConvert.DeserializeObject <List <Post> >(MyData); } }
public static void Exercice1() { Console.WriteLine("Exercice 1 : Encodeur JSON"); D d = new D(); Dictionary <string, object> dict = MyJSON.Serialize(d); Console.WriteLine(JsonConvert.SerializeObject(dict, Formatting.Indented)); Console.WriteLine(); }
public void LoadLocalInfo() { Debug.Log("LoadLocalInfo"); data = MyJSON.LoadInfo<Data>(pathToFile); if (data == null) { Debug.Log("Error Loading Local Data"); } else { SaveLocalInfo(); } }
string GenerateAllVariables(List <MyVariable> variables) { string str = ""; foreach (MyVariable variable in variables) { str += MyJSON.GenerateVariable(variable.type, variable.name, variable.defaultValue); str += "\n"; } return(str); }
public void LoadData() { MyDataTest data = MyJSON.LoadInfo <MyDataTest>(Application.dataPath + "/../data.json"); if (data == null) { Debug.Log("File not found or not formated"); } else { Debug.Log(MyJSON.FormatJson(JsonUtility.ToJson(data))); } }
public void Load(string path) { try { var json = File.ReadAllText(path); data = JsonUtility.FromJson <MyJSON>(json); } catch (Exception e) { data = new MyJSON(); Debug.Log("Load data exception: " + e.Message); } }
public void SaveLocalInfo() { MyJSON.SaveInfo<Data>(this.data, pathToFile); }
public void SaveData() { MyDataTest data = new MyDataTest(); MyJSON.SaveInfo <MyDataTest>(data, "data.json"); }