How to add JObject property by path if not exists?
问题 Given the following code: var context = JObject.FromObject(new { data = new { mom = "", dad = "", sibling = "", cousin = "" } }); var path = "$.data.calculated"; var token = context.SelectToken(path); token will be null. Thus, of course, trying this will produce an exception: token.Replace("500"); I've seen other examples about how to add properties to a JObject , of course, but they all seem like you have to know something about the object structure beforehand. What I need to do is something