C#/JSON (2) 썸네일형 리스트형 [C#] WriteJson (Json.Net) //I would recommend Json.Net, see example below: List _data = new List(); _data.Add(new data() { Id = 1, SSN = 2, Message = "A Message" }); string json = JsonConvert.SerializeObject(_data.ToArray()); //write string to file System.IO.File.WriteAllText(@"D:\path.txt", json); //Or the slightly more efficient version of the above code (doesn't use a string as a buffer): //open file stream using (Str.. [C#] ReadJson / json 읽기 1. JsonConvert 사용 / 클래스를 형식에 맟춰 생성 public void LoadJson() { using (StreamReader r = new StreamReader("file.json")) { string json = r.ReadToEnd(); List items = JsonConvert.DeserializeObject(json); } } public class Item { public int millis; public string stamp; public DateTime datetime; public string light; public float temp; public float vcc; } 2. JsonConvert 사용 / dynamic 사용 dynamic array = JsonC.. 이전 1 다음