Using JSON.Net, how do I get the native type of a value in a JSON file? Namely, I'm after simply if it's a string (value enclosed in quotations) or not.
var json = (JObject) JsonConvert.DeserializeObject(newVersion.JSON);
foreach (var data in json)
{
if(data.value IS STRING){
}
}
You can simply check the Type
property of each JToken
in your list:
foreach (var data in json)
{
if (data.Value.Type == JTokenType.String)
// ...
}
}
See JTokenType
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With