JSON.NET JObject键比较不区分大小写

方法1

JObject json = (JObject)JsonConvert.DeserializeObject(ptString);

Dictionary<string, object> d = new Dictionary<string, object>(json.ToObject<IDictionary<string, object>>(), StringComparer.CurrentCultureIgnoreCase);

String f = d["FROM"].ToString();

方法2

var json = @"{UPPER: 'value'}";

var jObj = JObject.Parse(json);

var upper = jObj.GetValue("upper", StringComparison.OrdinalIgnoreCase)?.Value<string>();

Console.WriteLine(upper); // value

 

posted @ 2024-04-09 08:50  zzzp0755  阅读(75)  评论(0编辑  收藏  举报
今天的苦果,是昨天的伏笔,当下的付出,才是明日的花开!加油!!!加油!!!