jq select

When working with JSON in Linux, it is good that we can clean records based on certain field values.
It is a lightweight command line JSON processor that is very simple and easy to use. It provides us with a simple and easy way to filter JSON records with the select() function.
The jq 'select()' function assess return the true or false impression.

jq select

on Jan 01, 1970
$ jq '.[] | select(.location=="Stockholm")' json
{
  "location": "Stockholm",
  "name": "Walt"
}
{
  "location": "Stockholm",
  "name": "Donald"
}

Add Comment

0

jq filter array

on Jan 01, 1970
$ json='[{"genre":"deep house"}, {"genre": "progressive house"}, {"genre": "dubstep"}]'
$ echo "$json" | jq -c '.[] | select(.genre | contains("house"))'
{"genre":"deep house"}
{"genre":"progressive house"}

Add Comment

0

Above I tried to explain the jq 'select() shortly. Hopefully, you understood this.

Shell/Bash answers related to "jq select"

View All Shell/Bash queries

Shell/Bash queries related to "jq select"

Browse Other Code Languages

CodeProZone