我的JSON:查询的JSON数组/ JObject
"CustomData": [
{
"Key": "RegistrationWrx",
"Value": "Wrx45687",
"Id": 462,
},
{
"Key": "IsConsentGiven",
"Value": "True",
"Id": 463,
},
我使用它来获取一些值:
string fetchResult = JsonConvert.SerializeObject(sidebar, Formatting.Indented);
JObject rss = JObject.Parse(fetchResult);
ConsentGiven = rss["RegistrationCase"]["CustomData"][1]["Value"].Value<string>(),
但我要检查的 “钥匙” 例如在“CustomData”上并显示“Value”。我想我需要做类似的事情:
ConsentGiven = rss["RegistrationCase"]["CustomData"].Where(["Key"]=="IsConstantGiven")["Value"].Value<string>(),
的事情是一个类linq查询。不知道是否有可能,但是像这样:ConsentGiven = rss [“RegistrationCase”] [“CustomData”]。Where([“Key”] ==“IsConstantGiven”)[“Value”]。 – stianboe