skip to Main Content

Docker – Access array list item by name using jq

Consider the following json data, sourced from from Docker image nginx:1.25-bookworm: # docker pull nginx:1.25-bookworm # docker image inspect 81be38025439 | jq '.[].Config.Env' [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "NGINX_VERSION=1.25.3", "NJS_VERSION=0.8.2", "PKG_RELEASE=1~bookworm" ] # I would like to be able to access '1.25.3' from…

VIEW QUESTION

Parse multilevel json into a csv using jq tool in unix

I have a multilevel json like so: { "id": "id123", "details": { "prod": "prod123", "etype": "type1" }, "accounts": [ { "bankName": "bank123", "accountType": "account123", "openingBalance": "bal123", "fromDate": "2023-01-01", "toDate": "2023-01-01", "missingMonths": [], "transactions": [ { "dateTime": "2020-12-01", "description": "a very…

VIEW QUESTION

Ubuntu – Convert .json to .csv

jq version jq-1.6 on Ubuntu 22.04.2 LTE Looking to convert large .json file to .csv json example: {"_id":{"$oid":"5200a366e36f237975000783"},"derived_form":{"$numberInt":"1"},"intransitive":true,"lemma":"badbad","phonetic":"bɐdbɐt","pos":"VERB","root":{"radicals":"b-d-b-d"},"sources":["Spagnol2011","Falzon2013"],"glosses":[{"gloss":"to fornicate","examples":[]},{"gloss":"to cough a lot","examples":[]}],"norm_freq":{"$numberDouble":"0.0"}} How do I convert to .csv: 5200a366e36f237975000783, badbad, bɐdbɐt, VERB, true, b-d-b-d, "to fornicate, to cough a lot"…

VIEW QUESTION

flatten json object using jq

I have the following json object: { "id":1, "activities":[ {"time":1659800397,"cities":["london","paris"],"type":1}, {"time":1659800411,"cities":["rome"], "type":2} ] } I would like to flatten it to the following tab separated structure, perhaps using jq id time cities type 1 1659800397 london 1 1 1659800397 paris…

VIEW QUESTION
Back To Top
Search