jq Arrays and Objects/Map object values

Transform each value while keeping keys unchanged.

Section: Entries and Key-Value Maps

Map object values

bash
bash
echo '{"a":1,"b":2}' | jq 'map_values(. * 10)'
Explanation

`map_values()` is concise when only object values need changing.

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 Entries and Key-Value Maps
Filter object entries by value
Remove entries below a threshold.
OpenIn sheetbashsame section
Rename keys with entries
Rename object keys during transformation.
OpenIn sheetbashsame section
Create object from array items
Index objects by a field.
OpenIn sheetbashsame section
Create grouped object
Group items by key and emit object buckets.
OpenIn sheetbashsame section
Object values
Return all object values as an array.
OpenIn sheetbash2 tag match
Keys unsorted
Return keys preserving insertion semantics when possible.
OpenIn sheetbash2 tag match