jq Trainer

Learn jq by writing the filter that pulls the target out of a JSON document, in as few characters as you can.

Level 1 of 12

The whole document

A jq filter is a little program that takes one JSON value and makes new ones out of it. `.` is the shortest filter there is: it hands the document straight back, unchanged. Everything else is built on top of it.

The document

{
  "pond": "east",
  "ducks": 4,
  "open": true
}

Nothing runs yet. Type a filter and watch the output beside the target: every line that doesn’t match is marked.

Its output

{  "pond": "east",  "ducks": 4,  "open": true}

The target

{  "pond": "east",  "ducks": 4,  "open": true}

More in the yard