Skip to main content

Get a list of values in a JSON object with jq

  • Tagged with jq
  • Posted

The equivalent to Python’s dict.values() is jq '[.[]]'.

Here’s an example:

$ echo '{"1": ["one", "uno", "eins"], "2": ["two", "dos", "zwei"], "3": ["three", "tres", "drei"]}' > numbers.json

$ jq -c '[.[]]' numbers.json
[["one","uno","eins"],["two","dos","zwei"],["three","tres","drei"]]

How it works: