Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Towards a shared understanding of JSONPath #15

Open
2 tasks
cburgmer opened this issue Jan 3, 2020 · 1 comment
Open
2 tasks

Towards a shared understanding of JSONPath #15

cburgmer opened this issue Jan 3, 2020 · 1 comment

Comments

@cburgmer
Copy link

cburgmer commented Jan 3, 2020

You might find https://cburgmer.github.io/json-path-comparison/ interesting to align with other implementations of JSONPath. To give an idea what's possible here are two queries which are currently not supported by jaxon/return the wrong results.

  • $[-1]
    Input:

    ["first", "second", "third"]
    

    Expected output:

    ["third"]
    

    Actual output:

    []
    
  • $..key
    Input:

    {"object": {"key": "value", "array": [{"key": "something"}, {"key": {"key": "russian dolls"}}]}, "key": "top"}
    

    Expected output:

    ["russian dolls", "something", "top", "value", {"key": "russian dolls"}]
    

    Actual output:

    ["top"]
    

Let me know if this is helpful to you.

For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/master/implementations/Elixir_jaxon.

@tiagodavi
Copy link

Thank you for the library.

Hi @cburgmer

I am wondering how to slice the json?

I tried Jaxon.Stream.query(Jaxon.Path.parse!("$[0:3].Player")) to get first 3 players I have, but it does not work.

How can I use it correctly to get only partial data and filters?

Should I use Enum.take?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants