字符串的内容:Maintenancedata=“[{"MaintenanceID":"1","MaintenanceName":"Rust Removal","Description":"","Color":"#ece765","Status":"1","Instruction":""},{"MaintenanceID":"2","MaintenanceName":"Dust Removal","Description":"","Color":"#fba2da","Status":"1","Instruction":""}]”
#region 解析 Maintenancedata
JObject[] jo = JsonConvert.DeserializeObject<JObject[]>(Maintenancedata);
foreach (JObject ject in jo)
{//循环遍历每组数据
if (ject != null && ject.Count > 0)
{
var lstObjectKey = ject.Properties().ToList();
//获取数据
for (int i = 0; i < lstObjectKey.Count(); i++)
{
var p = lstObjectKey[i];
var sNewKey = p.Name;//键
var singleValue = ject[p.Name].ToString();//值
}
}
}
#endregion