Systems & CLI · Intermediate
jq: Build a JSON Query Tool
Build a command-line tool that reads JSON on stdin and filters, indexes, and transforms it with a small path-and-pipe query language you design and implement.
You build a command-line clone of jq that reads JSON from stdin or a file and applies a query expression to filter and reshape it, printing the result. The work has two halves: parsing a JSON document into a tree, and designing a small query language with identity, field access, array indexing, slicing, the pipe operator, and a few built-in functions like length and keys. You write a parser for the query language and an evaluator that walks the JSON tree according to the parsed query. It is worth building because it combines real parsing with interpreter design and Unix pipeline ergonomics, all skills that show up in tooling, data plumbing, and backend work. It is resume-worthy because most engineers use jq daily but few understand how a query language is parsed and evaluated.
What you build
- Reads JSON from stdin or a file argument
- Supports the identity filter and chained field access like .user.name
- Indexes and slices arrays such as .items[0] and .items[2:4]
- Implements the pipe operator to compose filters left to right
- Provides built-ins like length, keys, type, and has
- Iterates arrays and objects with the .[] construct
- Pretty-prints output with optional compact and raw modes
What it teaches
- Designing a small domain-specific query language
- Tokenizing and parsing expressions into an AST
- Tree-walking interpreter evaluation
- Composing transformations with a pipe operator
- Unix stdin/stdout and CLI argument handling
- Mapping a language spec onto a tree data model
Sign in to open the build guide
Free account. Get the step-by-step build and every resource link.
Take it further
- Add the comma operator and object/array construction syntax.
- Support select() and arithmetic over numeric values.
- Add a -c compact flag and exit codes matching real jq.


