How to get key names from JSON using jq

You can use: jq ‘keys’ file.json Complete example $ cat file.json { “Archiver-Version” : “Plexus Archiver”, “Build-Id” : “”, “Build-Jdk” : “1.7.0_07”, “Build-Number” : “”, “Build-Tag” : “”, “Built-By” : “cporter”, “Created-By” : “Apache Maven”, “Implementation-Title” : “northstar”, “Implementation-Vendor-Id” : “com.test.testPack”, “Implementation-Version” : “testBox”, “Manifest-Version” : “1.0”, “appname” : “testApp”, “build-date” : “02-03-2014-13:41”, “version” : … Read more

How to filter an array of objects based on values in an inner array with jq?

Very close! In your select expression, you have to use a pipe (|) before contains. This filter produces the expected output. . – map(select(.Names[] | contains (“data”))) | .[] .Id The jq Cookbook has an example of the syntax. Filter objects based on the contents of a key E.g., I only want objects whose genre … Read more

Using jq to parse and display multiple fields in a json serially

I recommend using String Interpolation: jq ‘.users[] | “\(.first) \(.last)”‘ We are piping down the result of .users[] to generate the string “.first .last” using string interpolation. \(foo) syntax is used for string interpolation in jq. So, for the above example, it becomes “Stevie Wonder” (“.users[].first .users[].second” working elementwise) and “Michael Jackson”. jq reference: String … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)