public class JsonResult<T>
{
public JsonResult()
{
Value = default(T);
}
public string Status { set; get; }
public T Value { set; get; }
}
public async Task<JsonResult<string>> LoginApi(User userFromFore)
搞了我老半天发现原来返回的json是 status而不时Status.问题来了,我偏要保持大小写怎么办?Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你主动把它序列化成字符串呗。
using Newtonsoft.Json; namespace xxx{ public class JsonResult
{
public JsonResult()
{
Value = default(T);
}
[JsonProperty("Status")]
public string Status { set; get; }
[JsonProperty("Value")]
public T Value { set; get; }
}
} core里很多json序列化的地方都比改成驼峰明明了.包括signalr.
解决办法是修改全局json序列化配置
比如