.Net Json to JObject转换的使用方法

JObject变Json字符串

JObject jsonObj = new JObject();
jsonObj.Add("PID", JToken.FromObject(OrderFinanical.PID));
jsonObj.Add("BidUID", JToken.FromObject(OrderFinanical.BidUID));
jsonObj.Add("InvestmentTerm", JToken.FromObject(OrderFinanical.InvestmentTerm));
string content = jsonObj.ToString();

Json字符串变JObject

JObject jsonObj = JObject.Parse(content);
long bidUID = jsonObj.GetValue("BidUID").ToObject();
int investmentTerm = jsonObj.GetValue("InvestmentTerm").ToObject();

你可能感兴趣的:(.Net Json to JObject转换的使用方法)