Adapted from this post on Processing JSON with jq, you can use the select(bool)
like this:
$ jq '.[] | select(.location=="Stockholm")' json
{
"location": "Stockholm",
"name": "Walt"
}
{
"location": "Stockholm",
"name": "Donald"
}
More Related Contents:
- Passing bash variable to 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 convert a JSON object to key=value format in jq?
- How to format a JSON string as a table using jq?
- Exporting JSON to environment variables
- Convert a JSON array to a bash array of strings
- Create JSON using jq from pipe-separated keys and values in bash
- Constructing a JSON object from a bash associative array
- Parsing JSON with Unix tools
- How to convert arbitrary simple JSON to CSV using jq?
- Build a JSON string with Bash variables
- Accessing a JSON object in Bash – associative array / list / another model
- Using curl POST with variables defined in bash script functions
- how to parse a JSON String with jq (or other alternatives)?
- Read JSON data in a shell script [duplicate]
- How to filter an array of objects based on values in an inner array with jq?
- How to check if element exists in array with jq
- jq: Object cannot be csv-formatted, only array
- jq: print key and value for each entry in an object
- How to convert a JSON object stream into an array with jq
- How to filter array of objects by element property values using jq?
- How to get key names from JSON using jq
- Escaping characters in bash (for JSON)
- Bash script: Use string variable in curl JSON Post data
- Reusable function to group_by but return an object with group as key
- Parse JSON to array in a shell script
- Split a JSON file into separate files