Is JPath the same as JSONPath in JSON.NET?

扶醉桌前 提交于 2021-02-19 00:37:28

问题


Although the names look similar, small changes could be tricky. Unfortunately I cannot find decent info about JPath.

The docs of JSON.NET are talking about JPath and JSONPath and I think there are the same. Am I correct?

A String that contains a JPath expression.

from JToken.SelectToken (see also source code)

This sample loads JSON and then queries values from it using SelectToken(String) with a JSONPath query.

Which is using JObject.SelectToken (inherited from JToken)

from Querying JSON with JSONPath


回答1:


I dived into this and found the issue.

  • In the namespace 'Newtonsoft.Json.Linq.JsonPath' there is also a class JPath, which is the implementation of the JSON expression. It's probably not called JsonPath as it will be an issue with the namespace.

So, the JPath is the implementing class for JSON Path and thus there are the same.

Side note: created a PR for this - and it's merged! :)



来源:https://stackoverflow.com/questions/49981643/is-jpath-the-same-as-jsonpath-in-json-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!