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"
}
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"}
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 queriesShell/Bash queries related to "jq select"
Browse Other Code Languages
Abap ActionScript Assembly BASIC C C# C++ Clojure Cobol CSS Dart Delphi Elixir Erlang F# Fortran Go Groovy Haskell Html Java Javascript Julia Kotlin Lisp Lua Matlab Objective-C Pascal Perl PHP PostScript Prolog Python R Ruby Rust Scala Scheme Shell/Bash Smalltalk SQL Swift TypeScript VBA WebAssembly Whatever