skip to Main Content

Json – get a value with jq by matching one of parent value from a variable

I have JSON data as below, in services.json { "checkout-serviceA":{"prId":6644,"Sourcebranch":"","HFX":false,"IS_CR":"Yes"}, "checkout-serviceB":{"prId":15826,"Sourcebranch":"","HFX":false,"IS_CR": "no"}, "checkout-toggle":{"prId":8963,"Sourcebranch":"","HFX":true,"IS_CR": "Yes"}, "checkout-res":{"prId":1104,"Sourcebranch":"","HFX":false,"IS_CR": "Yes"} } I have a variable eg $PRID that contains prID value already. I want to pass this to jq and fetch or get an…

VIEW QUESTION

Convert a single JSON to multiple jsons by taking one of the key values? – Amazon Web Sevices

I currently have one json file as follows in terms of formatting: { "Comment":"json data", "Changes":[ { "Action":"DELETE", "ResourceRecordSet":{ "Name":"record1", "Type":"CNAME", "SetIdentifier":"record1-ap-northeast", "GeoLocation":{ "CountryCode":"JP" }, "TTL":60, "ResourceRecords":[ { "Value":"record1" } ], "HealthCheckId":"ID" } }, { "Action":"DELETE", "ResourceRecordSet":{ "Name":"record2", "Type":"CNAME", "SetIdentifier":"record2-ap-south",…

VIEW QUESTION

Json – Can this jq map be simplified?

Given this JSON: { "key": "/books/OL1000072M", "source_records": [ "ia:daywithtroubadou00pern", "bwb:9780822519157", "marc:marc_loc_2016/BooksAll.2016.part25.utf8:103836014:1267" ] } Can the following jq code be simplified? jq -r '.key as $olid | .source_records | map([$olid, .])[] | @tsv' The use of variable assignment feels like cheating…

VIEW QUESTION
Back To Top
Search