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

Path Operator on empty array returns *no data* which doesn't work nicely with boolean function #718

Open
vuquocbao opened this issue Nov 15, 2024 · 0 comments

Comments

@vuquocbao
Copy link

Hello,

I'm running into an issue where performing a . operator on an empty array returns no data.

Example:
Lets say I have a json like this

{
   "myList": []
}

If I do an expression like this $boolean(myList) I get false.

But if I do something like this $boolean(myList.someVar) I get undefined.

This causes some problems because lets say the list contains a JsonObject. The second expression only works if there is at least one object in the list.

Note that if I use the $count function instead of the boolean it will always return 0.

I also encounter this problem when filtering.

So if I do something like this myList[type = 'SomeType']. If the list is empty that returns undefined or no data in the online editor. If there is at least one item that matches the filter it gets returns. If there is no items that matches it returns undefined.

But I think the biggest problem is how $boolean does work for undefined results like javascript. Ideally calling $boolean should return false if the filtering or path operation on the array results in undefined

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

1 participant