I have this working code that uses Newtonsoft to deserialize a json string into a dynamic object.
dynamic json = JsonConvert.DeserializeObject<dynamic>(ResultJson);
and then I search for a particular token to get its property name
var countries = json.SelectTokens("$..CountryValue");
foreach (var token in countries)
{
}
Using Visual Studio watch window during debugging, I can see the token
has {[ { "Code": "USA" }]}
My question is how do I grab the property value USA
from token
?
Updated: I managed to extract the property value with token[0].Code
. Problem solved.