什么是獲得價值的最佳方法:
{"profileObj"/span>。 {"Name"。 "xxx","FirstName"。 "xxx","FastName"。 "xxx","Email"。 "xxx"}}
uj5u.com熱心網友回復:
使用System.Text.Json試試這個
//your json
var json= "{"/span>profileObj"/span>: {"Name": "xxx","FirstName"。 "xxx","FastName": "xxx","電子郵件"。 "xxx"}}"。
使用System.Text.Json。
.....。
var jD= JsonSerializer.Deserialize<Root> (json)。
var value =jD.profileObj;
var name= value.Name;
或者你可以安裝Newtonsoft.Json nuget包并使用這段代碼
using Newtonsoft.Json;
.....
var jD = JsonConvert.DeserializeObject<Root>(json)。
......
類
public class ProfileObj
{
public string Name { get; set; }
public string FirstName { get; set; }
public string FastName { get; set; }
public string Email { get; set; }
}
public class Root
{
public ProfileObj profileObj { get; set; }
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/328667.html
標籤:
上一篇:ASP.NETCore托管服務ExecuteAsync()方法沒有完成
下一篇:nginx反向代理取決于請求的埠
