GithubHelp home page GithubHelp logo

Comments (7)

danielaparker avatar danielaparker commented on June 15, 2024 2

Goessner, when discussing dot notation and bracket notation, says that "...output paths will always be converted to the more general bracket–notation", which suggests the correct return value would be $['a']['b'], not $.a.b.

from json-path-comparison.

gregsdennis avatar gregsdennis commented on June 15, 2024 1

Maybe it's sufficient to just have a check to see if it's supported for a given library.

If the unit JSON has unique values, then testing on the values returned would be good enough to know that the query did what we expect.

From there, it's a reasonable assumption that the paths to the values would be correct.

from json-path-comparison.

gregsdennis avatar gregsdennis commented on June 15, 2024 1

While I understand the tendency to use JSON Path for the locations (seeing as that's what we're building, which is likely why Goessner suggested it), I don't think that it's appropriate for this use case. JSON Pointer is more appropriate here since it's designed to isolate and identify a single value from a document. JSON Path is a query syntax and returns an array of values.

JSON Pointer is an extremely simple syntax that's already in spec and has wide library support.

from json-path-comparison.

remorhaz avatar remorhaz commented on June 15, 2024

My remorhaz/php-json-path supports returning paths (with one of these methods of processor). But I don't think that checking this behaviour is of big value: the main problem is that different implementations select different values, not paths.

from json-path-comparison.

cburgmer avatar cburgmer commented on June 15, 2024

We could include it in the scope.
I would probably only invest if enough libraries support this operation and there's a tendency to agree on a similar response type.

I know of the Clojure implementation also supporting this, as I implemented it 3 years ago :)

from json-path-comparison.

remorhaz avatar remorhaz commented on June 15, 2024

But what we should check in this case? For example, implementation X returns $.a.b, and implementation Y returns $["a"]["b"] as a path string. The expressions are different, but they do the same work and return the same value.

The question is - is there any reason for the paths not to be different?

from json-path-comparison.

cburgmer avatar cburgmer commented on June 15, 2024

If we see that response formats are different, we might be able to write a trivial transformation.

As for why answers should be different, I would expect less deviation once the actual JSONPath responses are aligned. However I wouldn't rule out misalignment there either, I'm always surprised what I find once I dare to check.

from json-path-comparison.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.