[jq] Build an object from an array of key-value entries

Created on November 30, 2026

Use from_entries to turn an array of objects with key and value fields into a single object.

echo '[{"key":"name","value":"Taro"},{"key":"age","value":30}]' | jq 'from_entries'
{
  "name": "Taro",
  "age": 30
}

Each key becomes a property name. Its corresponding value becomes the property value. Use to_entries to convert an object in the reverse direction.

Reference

jq