-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
The instructions for the "objects" lesson always show what followsjq enclosed in single quotes, e.g. the '[.foo]' in the first example:
$ echo '{"foo": { "bar": "a value" }}' \
| jq '[.foo]'
In the interactive tutorial, following suit with single quotes succeeds in the first two exercises:
Given: 'product' (type "data?" to view)
Challenge: Create a new object containing just the "name" field
> '{name}'
--------------------------------
Given: 'product' (type "data?" to view)
Challenge: Construct an array containing the product's name
> '[.name]'
But fails in the 3rd:
--------------------------------
Given: 'product' (type "data?" to view)
Challenge: Extend the product with { color: "red" }
> '{ price, name, "color":"red" }'
Command failed: jq ''{ price, name, "color":"red" }'' /usr/local/lib/node_modules/jq-tutorial/data/product.json
jq: error: syntax error, unexpected $end (Unix shell quoting issues?) at <top-level>, line 1:
{
jq: 1 compile error
I had no idea what I was doing wrong. Finally looked at the solution the in code and realized I was expected to omit the single quotes:
> { price, name, "color":"red" }
Suggest calling out in the instructions to omit them (or making it work with single quotes).
I'd be happy to update the instructions if you agree. Thanks!
Metadata
Metadata
Assignees
Labels
No labels