Json 转换为c#数组

Posted on 2020-01-17 10:04  杭州丑八怪  阅读(816)  评论(0编辑  收藏  举报
 string json="{\"PersonID\":\"1,2,3,4,5\"}";
JObject json2 = (JObject)JsonConvert.DeserializeObject(JsonPList2); List<string> PersonList2 = new List<string>(); string test2 = json2["PersonID"].ToString(); string[] strArray2 = test2.Split(','); int y = 0; for (int i = 0; i < strArray2.Length; i++) { PersonList2.Add(strArray2[i]); y++; }