-
Notifications
You must be signed in to change notification settings - Fork 221
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
Blocks does not work with nested array structure #332
Comments
My co-worker was trying some other inputs and got the expected behavior by wrapping my JSON input 2:
Expression 4:
Actual Output 4:
|
Just tried another input with a nested array with the same JSON input 3:
Expression 5:
Actual Output 5:
|
Yes, the result of your expression 3 looks like a bug. |
@yahelnachum - because the input data is an array, to access the first item, you can use
which will return
|
This issue is related to how JSONata handles input arrays. There is a lengthy discussion in #170 on this topic. I'm currently prototyping a solution that uses explicit syntax to determine whether to map over the input array verses just use it as a single context value. |
resolved by #363 |
Summary
In the jsonata playground I was trying out parenthesized expressions and blocks and came across some inconsistent output. I used blocks to turn a selection into an array so that I could pick a single index. Then when I tried adding a key to step into that single index it seemed to revert back to a selection.
More Details
JSON Input 1:
Then I tried a series of JSONata expressions
Expression 1:
Actual Output 1:
Expression 2:
Actual Output 2:
Expression 3:
Actual Output 3:
I would have expected the output of
Expression 3
to be the following given that I was able to select a single index inExpression 2
.Expected Output 3:
This seems to me like a bug in the code somewhere, but if there is an explanation for this behavior then please let me know what that is. Thanks in advance for reading!
The text was updated successfully, but these errors were encountered: