我的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