【发布时间】:2021-03-06 13:35:04
【问题描述】:
我有一个问题,当将 json 从客户端传递到 bakend 时,一个属性无法映射到实体。这是我作为参数收到的模型。
public class Utnker
{
public string Property1 { get; set; }
...
public TimeSpan time { get; set; }
}
当我使用字符串打发时间时,它无法触发bakend。
let Data = {
'Property':'b',
'time':'10.12:6:8'
};
fetch('', {
method: 'POST',
mode: 'cors',
credentials: 'include',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: JSON.stringify(Data)
}).then(function(response) {
console.log(response);
});
当我使用本地的json转换器转换json时,可以得到预期的结果。
【问题讨论】:
-
这能回答你的问题吗? Using Json to Serialize/Deserialize TimeSpan
标签: .net asp.net-core