1.json转model
TestModel tm = new TestModel();
JavaScriptSerializer js = new JavaScriptSerializer();
tm = js.Deserialize<TestModel>(JsonString);
2.model转json
方式1:
string Json = JsonConvert.SerializeObject(tm);
方式2:会将时间转换为 时间戳格式
JavaScriptSerializer js = new JavaScriptSerializer();
string json= js.Serialize(tm);
3.List<string> 转string
string s = string.Join(",", list.ToArray());
4.string 转 List<string>
string[] itemidList = idList.Split(',').ToArray();