我正在尝试发布一个数组,其中一个成员是字符串数组,我对该数组进行了字符串化,这是它看起来是字符串化的滚刀:
[{"id":"201669887","name":"אורה","Sunday":"1","Monday":"1","Tuesday":"1","Wednesday":"0","Thursday":"1","Friday":"1","Sunday1":"1","Monday1":"1","Tuesday1":"1","Wednesday1":"0","Thursday1":"1","Friday1":"0","totalWorkHour":9,"th":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"year":" ","schoolName":null,"schoolNumber":null},{"id":"201669887","name":"חנה","Sunday":"1","Monday":"1","Tuesday":"1","Wednesday":"0","Thursday":"1","Friday":"1","Sunday1":"1","Monday1":"1","Tuesday1":"1","Wednesday1":"0","Thursday1":"1","Friday1":"0","totalWorkHour":9,"th":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]
我在Mvc中有一个模型:
public class teachersExcelDataModel
{
.....
public int Thursday1 { get; set; }
public int Friday1 { get; set; }
public int totalWorkHour { get; set; }
public List<string> th { get; set; }
public string schoolName { get; set; }
public int schoolNumber { get; set; }
public string month { get; set; }
public string year { get; set; }
public teachersExcelDataModel()
{
th = new List<string>();
}
}
这是我发送的方式:
this.http.post(this.accessPointUrl3, JSON.stringify(this.sendData), { headers: this.headers }).subscribe(
noteRecord => {
if (noteRecord)
this.a = true;
}
);
这是我的方法:
public void PostExportExcel([FromBody]List<teachersExcelDataModel>json)
但是它为空,如果我将其作为对象[],那就可以了,我在哪里错?
基于我从问题中看到的内容,json格式不正确。也缺少“}”和“]”。