tools / json / jmespath / jmespath: build a flat list from multiple fields
json query · jmespath

JMESPath multiselect list

Build a flat array combining multiple fields from each input object — `[field1, field2]` syntax. Useful for projecting a small subset of fields into a CSV-friendly shape.

intermediate jmespath / aws cli

The query

users[*].[name, email, role]

Pass / fail

InputResult
Input: {"users":[{"name":"Ada","email":"a@x","role":"admin","created":"2024"}]}passes
Output: [["Ada", "a@x", "admin"]]passes
users[*].{name, email} (MULTISELECT HASH SYNTAX — produces objects, not arrays)fails
users[*][name, email] (INVALID — bracket projection syntax)fails

Edge cases & caveats

Multiselect list `[a, b, c]` produces array. Multiselect hash `{a: x.a, b: x.b}` produces object. Both are valid; pick based on downstream consumer (CSV vs JSON).

Common use cases

Run JMESPath against piped JSON
jsonyo is the CLI twin of the jsonyo browser extension — validate against schemas, format, run JMESPath queries against piped JSON. Zero deps.
Open jsonyo  

Related

pretty-print json (formatted output) · chain expressions with pipes · extract values from nested arrays · validate json against a schema