1. 程式人生 > >.net core 中後臺獲取前臺 數據(post)的方法

.net core 中後臺獲取前臺 數據(post)的方法

json字符串 序列化 convert pda pub poi ade 反序列化 stream

[HttpPost]
public async Task<JsonResult> EditPoint()
{
Stream reqStream = Request.Body;
string text = "";
using (StreamReader reader = new StreamReader(reqStream))
{
text = reader.ReadToEnd(); ///這裏的 text 就是 json字符串,然後在 後臺反序列化 成 對象 就可以了

JSonfor tempdata = JsonConvert.DeserializeObject<JSonfor>(text); ////反序列化為 JSonfor 的對象
}

}

.net core 中後臺獲取前臺 數據(post)的方法