I forgot the closing parenthesis:

aws ecs list-services --cluster splat-dev --profile mfa |
  jq -r '.serviceArns[] | select(contains("edp-api-dev"))'
#                                                       ^
Answer from kumar on Stack Overflow
🌐
jq
jqlang.org › manual
jq 1.8 Manual
This is useful when using jq as a simple calculator or to construct JSON data from scratch. ... Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with --slurp, then the entire input is passed to the filter as a single long string. ... Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once.
Discussions

shell - Get an array containing partially matching search word from a json array with jq - Unix & Linux Stack Exchange
Given the following json data and "a" as a partially matching search word, how can I get an array ["a", "b", "c"], ["abc", "e", "f&q... More on unix.stackexchange.com
🌐 unix.stackexchange.com
JQ - filter datasets in array based on index value within each dataset of array.
I have a very large JSON file. Inside that JSON file I am only interested in the data that exists with a certain value in one of the indexes within… More on reddit.com
🌐 r/bash
8
3
October 31, 2023
json - jq: how to filter an array of objects based on values in an inner array? - Stack Overflow
I'm trying to construct a filter with jq that returns all objects with Ids that do not contain "data" in the inner Names array, with the output being newline-separated. More on stackoverflow.com
🌐 stackoverflow.com
How do I filter the contents of a json array, but keep the parent with jq? - Unix & Linux Stack Exchange
Which is close to what I want, but it doesn't have the parent array. So, I thought maybe I should put the parent array inside the select statement, like this: echo $JSON |jq -r '.|select(.Vpcs[].OwnerId!="abc")' But that doesn't seem to filter the data that I want: More on unix.stackexchange.com
🌐 unix.stackexchange.com
January 29, 2020
🌐
Container Solutions
blog.container-solutions.com › learn-jq-the-hard-way-part-iii-filters
Learn JQ the Hard Way, Part III - Filters
November 15, 2023 - The filter allows us to select those parts of the JSON document that we might be interested in. The simplest filter – and one you have already come across – is the ‘dot’ filter. This filter is a simple period character (.) and doesn’t do any selection on the data at all: ... Note that here we are using the filename as the last argument to jq, rather than passing the data through a UNIX pipe with cat. Now let’s try and create a similar array with the same name-value pairs, and run the dot filter against it:
🌐
Zendesk Developer Docs
developer.zendesk.com › documentation › integration-services › developer-guide › jq-cheat-sheet
jq cheat sheet | Zendesk Developer Docs
Use the sub filter to replace substrings using regex. The following expression replaces "john" with "richard". Important: Escape any JSON special characters in the regex pattern. ... The following expression uses an if-then-else conditional. The conditional checks whether objects in the "user" array contain an "alias" property. If the "alias" key is missing or the "alias" value is null, the expression sets the object's "alias" as an empty string.
🌐
HayaGeek
hayageek.com › home › json manipulation with jq filter – examples
JSON Manipulation with jq Filter - Examples
November 17, 2023 - The simplest jq filter is ‘.’ which prints the input as it is, but adding the ‘-C’ flag can prettify the output with colors. ... To filter an array and return its elements, you can use the ‘[.[]]’ syntax. ... To filter and retrieve a specific property from an object, use ‘.property_name’. ... To get a list of values from an array of objects, you can use ‘.[] | .property_name’.
🌐
Remysharp
jq.remysharp.com › mapping
Map, Filter, Reduce
Since jq pipes data in and out of filters, the same filter in jq looks like this: ... Remember that the . is the identifier (which I called data in JavaScript). Since the source data is an array, map works without any preceding code, and returns an array of email strings.
Find elsewhere
🌐
Reddit
reddit.com › r/bash › jq - filter datasets in array based on index value within each dataset of array.
r/bash on Reddit: JQ - filter datasets in array based on index value within each dataset of array.
October 31, 2023 - If it was instead a sequence of small objects, each object would be processed as soon as it was parsed. jq might use significantly less memory to do that, which may be important if your input is very large. But you've solved the problem, so I guess this wasn't an issue. :-) ... While we are at it... Is there a way I can modify the above to only export certain keys? ... Yeah, that's simply the filter { id, actor_id, message, creation_timestamp, object_id }.
🌐
DevDocs
devdocs.io › jq
DevDocs — jq documentation
jq 1.7 API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more.
🌐
Earthly
earthly.dev › blog › jq-select
JQ Select Explained: Selecting elements from JSON with Examples - Earthly Blog
July 24, 2023 - Everything in jq is a filter that you can combine with pipes (|). This mimics the behavior of a UNIX shell. You can use the pipes and the jq built-ins to build complicated transformations from simple operations.
🌐
W3cubDocs
docs.w3cub.com › jq
Jq Documentation - W3cubDocs
Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once. ... Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with --slurp, then the entire input is ...
🌐
GitHub
gist.github.com › ipbastola › 2c955d8bf2e96f9b1077b15f995bdae3
JQ to filter JSON by value · GitHub
Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611) Copy link · if searching for exact value don't use contains as that is substring/array lookup ) use == i.e. cat my.json | jq -c '.[] | select( ._id == 611 ) And if your input is not a large array, but rather individual lines of json then use ·
🌐
GitHub
github.com › jqlang › jq › issues › 33
filter on "string contains" · Issue #33 · jqlang/jq
October 23, 2012 - Perhaps I'm missing it, but I can't see a way to filter based on a value containing a string. Something like jq 'select(.msg.indexOf('Me") != -1)' Input [ {"msg": "Pick Me!", "date": "2012-10-22 04:42:05"}, {"msg": "Not this one","date":...
Author   billehunt