I have this code for getting values out of a json string.
var json = @"[{""property"":""Status"",""value"":""val""}]";
var jArray = JArray.Parse(json);
foreach (JToken jToken in jArray)
{
var property = jToken.Value<string>("property");
var value = jToken.Value<string>("value");
}
This works perfect for the provided input. But in some situations the value property may contain an array.
var json = @"[{""property"":""Status"",""value"":[1,2]}]";
I'd like to check somehow if the value contains a simple value or an array. If the value is an array then bind it to a collection.
Is this possible using JSON.net ?