jq Cheat Sheet/Get object property

Select a top-level property by key.

Section: Selectors and Paths

Get object property

bash
bash
echo '{"name":"alice","age":30}' | jq '.name'
Explanation

Returns the value of the `name` field.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Selectors and Paths
Get nested property
Select a value from a nested path.
OpenIn sheetbashsame section
Optional selector
Avoid errors when a key may be missing.
OpenIn sheetbashsame section
Check whether key exists
Return true if an object has a key.
OpenIn sheetbashsame section
List object keys
Return the keys of an object as an array.
OpenIn sheetbashsame section
Get array element by index
Return an item from an array by position.
OpenIn sheetbashsame section
Slice an array
Return a subrange of elements.
OpenIn sheetbashsame section