I am trying to extract the value of the message parameter under the messages array where the parameter name is equal to documentId (highlighted in bold below). However, the code I have tried so far does not achieve this as needed.
dynamic obj = JsonConvert.DeserializeObject(JsonDATA);
var recid = obj.messages.message;
JSON Data
{
"message": "Success",
"messages": [
{
"parameter": "documentId",
"message": "8111ffb4-dddc-4d94-b050-bf8fa050181f"
},
{
"parameter": "refNo",
"message": "INNT19/75254854"
}
]
}
I need assistance on how to specifically retrieve only the desired value in C#.