We can also use a slightly more concise version and access the property directly on each object in the array: jq '.name' fruits.json 4.2. The last step is to output the name field from each object using. Then we can pass each object in the array to the next filter in the command using a pipe |.
name' fruits.jsonįirst, we iterate over the array using. Let’s see how to extract the name of each fruit from each object in the array: jq '.
Now let’s imagine we want to represent a list of fruit in a JSON document: [Įach item in the array is an object that represents a fruit. in use, which will print out each item in the array on a separate line: "x" Here, we see the object value iterator operator. We’ll start with a basic example to demonstrate how to iterate over an array: echo '' | jq '.'