-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
add nested array indexing example #1849
base: master
Are you sure you want to change the base?
Conversation
I mean, the manual is littered with examples like this, but I guess the point is that just the section on array indexing can confuse people, so I'll take it. |
@@ -378,6 +378,10 @@ sections: | |||
input: '[1,2,3]' | |||
output: ['2'] | |||
|
|||
- program: '.letters[1]' | |||
input: '{"letters":["a","b","c","d"]}' | |||
output: '"b"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be output: ['"b"']
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example output needs to be corrected as commented before.
This PR adds an example to the docs to help people who've hit the snag
discussed in #1168.
Having an example allows people who hit this snag to relatively quickly
see what they've done wrong, rather than having to probe further into a
cryptic error message:
Having it just as an example allows people to be informed of the behavior
without the burden of needing to explain it with additional text.