I got the data from a identity check company in the form of JSON. I just need to get some data from that JSON file so I deserialized JSON file and tried to read a particular tag. I am always getting null value when I am trying to read the tag . Below is my JSON file and C# code:
{
"responseHeader": {
"requestType": "PreciseIdOnly",
"clientReferenceId": "21321",
"expRequestId": "213213",
"messageTime": "2020-05-28T00:00:02Z",
"overallResponse": {
"decision": "REFER",
"decisionText": "Continue & Investigate",
"decisionReasons": [
"Continue & Investigate"
],
"recommendedNextActions": [],
"spareObjects": []
},
"responseCode": "R123",
"responseType": "INFO",
"responseMessage": "Workflow Complete.",
"tenantID": "V123242"
},
"clientResponsePayload": {
"orchestrationDecisions": [
{
"sequenceId": "1",
"decisionSource": "PreciseId",
"decision": "REFER",
"decisionReasons": [
"Continue & Investigate"
],
"score": 737,
"decisionText": "Continue & Investigate",
"nextAction": "Continue",
"appReference": "22222",
"decisionTime": "2020-05-28T18:58:43Z"
}
]
}
}
Below is my code:
var data = (JObject)JsonConvert.DeserializeObject(JSONResponse);
string x = data["clientResponsePayload.orchestrationDecisions.sequenceId"].Value<string>();
JSONResponse is my JSON file from the company who is checking the identity. I get an error saying :
"Value cannot be null.\r\nParameter name: value
I am not sure what am I doing wrong. this JSON file is huge and have lot of nested JSON tags. This how I am Reading the JSON file send to me from the Identity check company:
HttpResponseMessage response = client.SendAsync(request).Result;
string responseContent = await response.Content.ReadAsStringAsync();