Index objects by a field.
Section: Entries and Key-Value Maps
Create object from array items
bash
bash
echo '[{"id":"u1","name":"alice"},{"id":"u2","name":"bob"}]' | jq 'map({key: .id, value: .name}) | from_entries'Explanation
Convenient for building lookup tables.
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