"dateOfBirth": "1974-06-10",
"ethnicGroup": "",
"historicalIDs": [],
"homeDeployment": null,
"iDs": [
{
"id": "E6051954",
"type": "EPI"
},
{
"id": "51005383",
"type": "IDX"
},
{
"id": "51005383",
"type": "IDXUNPAD"
},
{
"id": "500102779",
"type": "CHS"
},
{
"id": "18706344",
"type": "STAR"
},
{
"id": "0005700581",
"type": "N"
},
{
"id": "0005700581",
"type": "D"
},
{
"id": "0050750170",
"type": "E"
},
{
"id": "0050501702",
"type": "U"
},
{
"id": "0050501702",
"type": "C"
},
{
"id": "0050501702",
"type": "K"
},
{
"id": "0050501702",
"type": "M"
},
{
"id": "0050501702",
"type": "S"
},
{
"id": "0050501702",
"type": "R"
},
{
"id": " Z6287",
"type": "INTERNAL"
},
{
"id": "Z6287",
"type": "EXTERNAL"
}
],
"maritalStatus": "Single",
"name": "Interra,Craig"
this is JSON code and I want to display id of TYPE=CHS. Always it changes the sequence so Can anyone give me the code for display id particular only for CHS.
What I have tried:
dynamic dJson3 = dJson["iDs"];
Log.Write("Value in djson3 " + dJson3.ToString());
var itemsA = dJson3["iDs"];
foreach (var item in itemsA)
{
if (dJson3["type"].ToString() == "CHS")
{
if (!string.IsNullOrWhiteSpace(dJson3["id"].ToString()))
{
kv.Add("Medical Record Number", dJson3["id"].ToString());
}
}
}
I tried this two method but not getting proper answer, getting exception of like
The best overloaded method match for 'System.Collections.Generic.Dictionary<string,object>.this[string]' has some invalid arguments
or cannont convert string to int