JObject
implements IDictionary<string, JToken>
, so you can use:
IDictionary<string, JToken> dictionary = x;
if (dictionary.ContainsKey("error_msg"))
... or you could use TryGetValue
. It implements both methods using explicit interface implementation, so you can't use them without first converting to IDictionary<string, JToken>
though.