I am using Newtonsoft.Json for parsing Json text. For a reason I need name of JToken or Jvalue object. As per example if “ChoiceId”:865 is JValue then I need to get “ChoiceId”. But I am trying it for few hours now but could not figure out how. How can I get that name ?
Thanks
EXAMPLE:
if this is the json file content:
{"ChoiceId":868,"Choice":"Post","Url":"/pst/goods"}
Then I can get ChoiceId value by using
JObject json = JObject.Parse(hole);
JValue jvalue = (Jvalue)json["ChoiceId"];
string value = jvalue.Value;
But there is no property for getting the name ie.”ChoiceId” . So my question is that how can I get it ?
As I’ve seen none of your code thus I’m spitballing, perhaps you’re looking for
JToken.ParentandJProperty?