jq '.[0] | keys' data.json

Category: Data Science & Analysis

jq '.[0] | keys' data.json

List the keys of the first JSON object

The keys filter returns the field names of an object as a sorted array. Applied to .[0], the first element, it reveals the schema of one record. This is the fastest way to discover what fields a JSON dataset contains. Use keys_unsorted to preserve the original field order.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.