string channelGroup=[{"SpType":"1","BaseInfoId":["xxx","xxx","xxx"]},{"SpType":"2","BaseInfoId":["xxx","xxx","xxx"]},{"SpType":"3","BaseInfoId":["xxx","xxx","xxx"]}]
需要先定义两个类
public struct ConfigCode {
public string SpType { get; set; }
public string[] BaseInfoId { get; set; }
}
public class JsonData {
public List<ConfigCode> ConfigCode;
}
var tmp= Newtonsoft.Json.JsonConvert.DeserializeObject<List<ConfigCode>>(channelGroup);//处理json字符串,其中的类库需要自己添加引用Newtonsoft.Json.dll
时间: 2024-10-11 01:43:54