One thing you can do is create a method you can pass the token into that will validate whether to object/property/element exists. You will need to have the NuGet package Newtonsoft.Json.Linq to perform this action.
Method:
public static bool TokenIsNullOrEmpty(JToken token)
{
return (token == null) ||
(token.Type == JTokenType.Array && !token.HasValues) ||
(token.Type == JTokenType.Object && !token.HasValues) ||
(token.Type == JTokenType.String && token.ToString() == String.Empty) ||
(token.Type == JTokenType.Null);
}
Then you can use a conditional to provide a value whether an element/object/property exists:
var variable = TokenIsNullOrEmpty(obj["object/element/property name"]) == false ? obj["object/element/property name"].ToString() : "";
Hope this was helpful. Regards.