From the docs:
jq '.[] | select(.id == "second")'
Input
[{"id": "first", "val": 1}, {"id": "second", "val": 2}]
Output
{"id": "second", "val": 2}
I think you can do something like this:
jq '.theList[] | select(.id == 2 or .id == 4)' array.json
More Related Contents:
- Passing bash variable to jq
- How to convert arbitrary simple JSON to CSV using jq?
- How to merge 2 JSON objects from 2 files using jq?
- Select objects based on value of variable in object using jq
- jq not working on tag name with dashes and numbers
- Iterating through JSON array in Shell script
- passing arguments to jq filter
- Modify a key-value in a json using jq in-place
- how to parse a JSON String with jq (or other alternatives)?
- How to convert a JSON object to key=value format in jq?
- Using jq how can I split a very large JSON file into multiple files, each a specific quantity of objects?
- jq: Object cannot be csv-formatted, only array
- jq: print key and value for each entry in an object
- How to format a JSON string as a table using jq?
- Get outputs from jq on a single line
- How do I update a single value in a json document using jq?
- Exporting JSON to environment variables
- How to convert a JSON object stream into an array with jq
- Convert a JSON array to a bash array of strings
- How to use jq when the variable has reserved characters?
- How to get key names from JSON using jq
- Reusable function to group_by but return an object with group as key
- Split a JSON file into separate files
- Create JSON using jq from pipe-separated keys and values in bash
- Constructing a JSON object from a bash associative array
- Angular 2: Get Values of Multiple Checked Checkboxes
- What is the JSON format? [closed]
- ASP JSON: Object not a collection
- Serialize in JSON a base64 encoded data
- Parsing JSON feed automatically into MS Access