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

Array slice on object, scalar response or not? #5

Closed
cburgmer opened this issue Jun 7, 2020 · 5 comments
Closed

Array slice on object, scalar response or not? #5

cburgmer opened this issue Jun 7, 2020 · 5 comments

Comments

@cburgmer
Copy link

cburgmer commented Jun 7, 2020

Running the array slice operator (e.g. $[1:3]) against an object (e.g. {}) currently returns null (see https://cburgmer.github.io/json-path-comparison/results/array_slice_on_object.html#Kotlin_com.nfeld.jsonpathlite).

As a user I would probably expect [] instead, considering the query is supposed to return multiple matches?

@cburgmer
Copy link
Author

cburgmer commented Jun 7, 2020

I'm not sure I understand your answer.

The link mentions all implementations, but the anchor highlights the Kotlin example, which is why I'm raising the issue here.

@hf-kklein
Copy link

sorry @cburgmer . I was wrong. My fault.

@codeniko
Copy link
Owner

codeniko commented Jun 9, 2020

Hi again, yes you're right, makes sense to return [] in this case

@codeniko
Copy link
Owner

This is addressed now for the upcoming version 2.0.0 release. I did a similar change for selectors like $[1,2,3] on a JSON object

@codeniko
Copy link
Owner

2.0.0 is now released addressing this issue, closing

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

3 participants