I have a json like this:
{
"Diagnoses": {
"WESTERN EQUINE ENCEPHALITIS": {
"ICD": "A83.1",
"ID": "9"
}
},
"ICD": {
"A83.1": {
"Name": "WESTERN EQUINE ENCEPHALITIS",
"ID": "9"
},
"A83.2": {
"Name": "EASTERN EQUINE ENCEPHALITIS",
"ID": "10"
}
}
}
My actual json is much longer. There are about 8000 items within Diagnoses and ICD each. I'm trying to find the best way to load all the keys into a list. First, I have the entire json in a JObject. To put it into a list, I'm doing this:
IList<JToken> jsonDiagName = jDiagnosis["Diagnoses"].Children().ToList();
foreach (JToken diagnosis in jsonDiagName)
{
cb_DiagName.Items.Add(diagnosis.ToObject<JProperty>().Name);
}
Where jDiagnosis is the JObject. However, with about 9000 items in the json, its taking about 3 minutes to load the list. So I searched for more efficient ways to do it and found this.
However, to try the suggestion in there, I need to extract the json under "Diagnoses" to be a JObject of its own. So, how can I make a JObject from an exising JObject?
Thank You