I'm facing an issue where I need to select and filter a value that contains a space in it. My attempt involves using a for loop, but unfortunately, I'm not getting any output with this approach. I even tried utilizing --arg name "$i", however, th ...
Among my JSON entities, there is one called 'info'. Take a look at it: null null { "id": "qwefhu214o", "number": "2346", "date": "28.01.2019" } null null { "id": " ...
To tackle the issue, my goal is to extract lines from a file that do not contain the specific pattern: "ddd":[ The target is to filter out lines like "memo": { or "notice": "delivered on 17", and only retrieve lines containing "ddd":[, disregar ...
I've been working on this code snippet: [ ["John Black",[ ["Lorem ipsum dolor sit amet.",27], ["Ut tempus lectus ut mi.",23] ]], ["Peter Pan",[ ["Quisque pulvinar odio.",22], ["Nec ut lorem quis inter ...
{ "accounts": [ { "accountId": "account001", "tokens": [ "tokens1", "tokens2", "tokens3", "tokens4", ] } ] } the ...
Having an issue with jq. Received the following data from API: { "items": [4,5,1,3,2], "objectNumbers": [ { "type": "objectNumber", "number": 8 }, { "type": "objectNumber", "number": 7 }, { ...
I'm faced with a challenge involving files containing multiple key value pairs that I need to convert into arrays. Allow me to demonstrate this with some examples from the file contents: # cat content/1.yaml time: "2020-09-14T22:33:40Z" id: ...
Exploring with jq and jmespath: I am intrigued by the objectId located in the middle of this string... I've attempted to use sed, regex, but there has to be a more clever solution... Command 1: az dls fs access show --account "$account" --path "$rootpath ...
I've been struggling to transform a rather flat JSON structure into one with more depth, but I haven't had any luck so far. Here is the initial data: [ { "id": "27", "time": "2017-12-21 07:24:00", "service_name": "prices", "vers ...
I need assistance parsing the below JSON output from Ansible using jq. Specifically, I am trying to extract the version number for a package named GeoIP. How can I efficiently utilize jq to retrieve this version number for the specified package? The desir ...
My goal is to include this block of code from the devices_format.json file: { "devices": [ { "name": "new_elsys", "objects": [ { "name": "ServerRoomTemp", "datapoint_type": "measurement", "coder_fiel ...
I have a json file called temp.json that looks like this: { "data": { "stuff": [ ..... ] }, "time": { "metrics": 83 } } I am looking to remove the following block of code from the JSON file: , ...
In my search, I have found many responses that are similar to what I need, but not quite there. I am working on parsing a JSON file using the following command: cat file.json | jq -r ".[] | select(.name == \"${VALUE}\" or .guid == ...
I encountered a JSON response consisting of three items with the following structure: { "id": 44, "extra": [{ "domain": { "id": 3, "name": "person" ...
How can I use jq to select a parent object that contains a child object meeting two filter requirements? For instance, I want to choose all Subnets elements with a child tag having key "Name" and value "TheName". There are two subnets in my example - one ...
Here is an example json file named payload.json.tpl: { "foo": "bar", "x": { "y": "${array}" } } In a bash script, I have defined an array like this: array=("one" "two" "three") I am looking for a way to use the jq command to update the key .x ...
I am attempting to utilize jq to parse the following JSON data: { "aaa-bbb-ccc": { "derp": blah } } Unfortunately, I am encountering this error message: cat myjson | jq -r .'aaa-bbb-ccc' jq: error: aaa/0 is not defined at <top-level ...
Dealing with a hefty file (20GB+ compressed) named input.json, filled with a stream of JSON objects like so: { "timestamp": "12345", "name": "Some name", "type": "typea" } { "timestamp": "12345", "name": "Some name", "type": "typea ...
I am working with a "config.json" file in my Dockerfile to adjust specific parameters. I need to generate a random string to replace the value of a field within this file. If we consider a file structure similar to the code provided below, with the field " ...
Need some assistance with jq: Is there a way to find "name" fields in JSON starting with an underscore (ex: _RDS_PASSWORD) and remove the underscore, resulting in RDS_PASSWORD? How can I utilize jq to locate "name" fields beginning with an underscor ...
When dealing with arguments that contain spaces, it's important to note that they may not pass correctly to the curl command. Additionally, quotes might not be properly transferred in the --data field. For example, if I simply echo the variable &apos ...
I want to create a script in bash that retrieves the final URL after redirection. For example, when google.com is redirected to http://www.google.com with a status of 301, I want to capture that redirect. Here's what I have attempted so far: json=&ap ...
Is there a way to sort the keys of a JSON file in natural order while prioritizing keys listed in the 'required' section? The command below sorts keys in natural order: jq --sort-keys . /tmp/source.json > ./tmp/target.json { "Request": { ...
I am faced with a situation where I have two separate log files named log.json and messages.json. The log file is structured as follows: {"msg": "Service starting up!"} {"msg": "Running a job!"} {"msg": "Error detected!"} The messages file has the fol ...
Exploring the integration of ANSI color codes with jq. Here are some test cases: $ echo '{"a":"b","c":"d"}' | jq -r .c d # Expected output $ echo '{"a":"b","c":"