从C#中包含子数组的Json访问单个数据

时间:2019-05-12 16:25:48

标签: c# json

我正在从Rest API中获取JSON值到我的C#程序中。 我陷入了如何处理单个数据的困境。

下面是我的Usermachine班:

public class Model
{
    [JsonObject]
    public class Usermachine
    {
        public string employeeid { get; set; }
        public string employeename { get; set; }
        public string mMacID { get; set; }
        public string machinename { get; set; }
        public int iscleaning { get; set; }
        public int isperforming { get; set; }
        public int isverifying { get; set; }
        public int cSeqno { get; set; }
        public string cMacID { get; set; }
        public int cInterval { get; set; }
        public int cCleanOperationMaxTime { get; set; }
        public int cPerformOperationMaxTime { get; set; }
        public int oSequenceID { get; set; }
        public string oMacID { get; set; }
        public string oItemNumber { get; set; }
        public string oBatchNumber { get; set; }
        public string oPONumber { get; set; }
        public int oCompletedOperation { get; set; }
        public int oComplOperStartTime { get; set; }
        public int oCompOperEndndTime { get; set; }
        public int oOperationToContinue { get; set; }
        public List<PInterval> PintervalList { get; set; }
    }
    public class PInterval
    {
        public string pMachineID { get; set; }
        public int pmachinetoLocationSequence { get; set; }
        public int pLocationNumber { get; set; }
        public string pLocationName { get; set; }
        public int pLocationInterval { get; set; }
        public int pImageRequiredForVerifying { get; set; }
        public int pErrorFound { get; set; }
    }
}

1 个答案:

答案 0 :(得分:0)

请按照以下说明从模型中重写行。

公共列表PInterval {get; set} = new List();

让我知道它是否有效。