[jq] Transform all values in an object with map_values

Created on November 30, 2026

map_values applies the same expression to every value. In this example, . represents the current property's value, so . * 2 doubles it. The keys stay the same.

echo '{"apple":100,"banana":200}' | jq 'map_values(. * 2)'

Output

{
  "apple": 200,
  "banana": 400
}
jq