I am using Newtonsoft.Json to parse Json text. For some reason, I need a JToken or Jvalue object name. For example, if "ChoiceId": 865 is a JValue, then I need to get "ChoiceId" . But I try this for several hours, but could not figure out how to do it. How can I get this name?
thanks
Example: if it is a json file:
{"ChoiceId":868,"Choice":"Post","Url":"/pst/goods"}
Then I can get the ChoiceId value using
JObject json = JObject.Parse(hole); JValue jvalue = (Jvalue)json["ChoiceId"]; string value = jvalue.Value;
But there is no property to get the name ie. "ChoiceId". So my question is, how can I get it?
Barun source share