I have some JSON which I inspect and parse into a JArray. The JSON is similar to this :
"required" : [ "1", "2" ]
Now when it parses, the outcome is an array of JValues. I want to check if my string appears in this list. So, to do this, I do :
JArray requiredArray = JArray.Parse(myJson["required].ToString()); bool exists = requiredArray.Contains("1");
This comes back as false, and I think its due to it comparing a JValue with a string. I try convert the string to a JValue like so :
JValue itemValue = JValue.Parse("1");
It doesn't like that, says cannot convert JToken to JValue.
All I need to know is, does my JArray contain this string value.