jq to_entries example

Convert a JSON object into an array of {key, value} pairs with jq to_entries. Interactive example for iterating over objects with dynamic keys.

The jq expression

to_entries

to_entries turns an object into an array of {key, value} objects, which is handy when keys are dynamic and you need to iterate over or transform them. In this example the object is keyed by user ids, and to_entries exposes each id as .key and the user record as .value so they can be processed as a list.