Skip to content

Call out in instructions when quotation marks are needed #6

@dsiegal

Description

@dsiegal

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions