How to use C# example using JsonPath?

前端 未结 3 770
一个人的身影
一个人的身影 2020-12-14 02:52

I\'m trying to use JsonPath for .NET (http://code.google.com/p/jsonpath/downloads/list) and I\'m having trouble finding an example of how to parse a Json string and a JsonPa

3条回答
  •  温柔的废话
    2020-12-14 03:29

    using Newtonsoft.Json.Linq yo can use function SelectToken and try out yous JsonPath Check documentation https://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_Linq_JObject.htm

    Object jsonObj = JObject.Parse(stringResult);
    
    JToken pathResult = jsonObj.SelectToken("results[0].example");
    
    return pathResult.ToString();
    

提交回复
热议问题