Skip to content
jsonblocks

jsonblocks and jq: a visual companion

jq is the standard terminal tool for slicing JSON; jsonblocks helps you see what to slice. Explore a document visually, copy the exact path, and paste it into a jq filter - the two tools complement rather than compete.

The typical jq session starts blind: you guess a filter, run it, read the error, and adjust. jsonblocks removes the guessing by showing the document structure first, with the exact path of every value one click away.

The explore-then-query workflow

  1. Paste the document into the path finder or the block visualizer.

  2. Click the value you want and copy its path, for example $.data[0].email.

  3. Convert to jq by swapping the root: jq '.data[0].email' data.json.

  4. Extend from a working base: add pipes, selects, and maps with confidence.

bash
# copied path:  $.data[0].email
# jq filter:  .data[0].email

jq '.data[0].email' response.json
jq '[.data[].email]' response.json

What each tool does best

Where to reach for each tool.
TaskReach for
See the shape of an unknown documentjsonblocks
Find one value and copy its pathjsonblocks
Transform or reshape data in bulkjq
Filter thousand-row arrays by conditionjq
Script JSON processing in CIjq
Explain a payload to a teammatejsonblocks

Path syntax translation

Viewer paths and jq filters differ only at the root: drop the $ and the rest is identical for simple keys. $.store.book[0].title becomes .store.book[0].title. The path finder shows both forms side by side so the translation is never a guess.

Frequently asked questions

Does jsonblocks replace jq?

No. jq transforms and scripts JSON at a scale no browser tool should attempt. jsonblocks covers the step before: understanding the document and finding exact paths to query.

How do I convert a copied path to jq?

For dot paths, remove the leading $: $.data[0].email becomes .data[0].email. Root bracket paths need a leading dot: $["odd.key"] becomes .["odd.key"]. Wrap simple paths as jq '.data[0].email' file.json. The path finder generates this snippet for any selected row.

Which should I learn first?

Both, in order: explore documents in jsonblocks until paths feel natural, then learn jq filters on documents you already understand. Debugging filters is far easier with a mental picture of the shape.