How to filter and exclude results with jq?
I'm a newbie with jq.I get this JSON with curl:{"invendus": [ {"automatique": false,"available": true,"createdAt": "2024-06-27T12:49:01.639270+02:00","dateCollecte": "2024-06-27","dateFinCollecte":...
View Articleinfinite include loop in jq. Two modules that need each other and one of them...
I have 2 modules that will convert code into strings, module1.jq and module2.jqmodule1 converts the code of obj1 that have this form{ "code1":"254", "Object2s":[ {Object2}, {Object2} ] }module2...
View Articlewhat is .. (two dots) in jq filter
given my input file: kind.json[ {"kind": "ConfigMap1" }, {"kind": "ConfigMap1" }, {"kind": "ConfigMap2" }, {"kind": "ConfigMap'4" }, {"kind": "ConfigMap\"6" }]and on using jq command jq .. kind.json, i...
View ArticleHow to install JQ on Mac on the command line?
I need to know the most efficient way of installing JQ on Mac (El Capitan). The code is downloaded to my Mac but I would like to know how I can install and operate it via the command line.
View ArticleHow can I write a jq expression to convert nested array objects in JSON to a...
I have a JSON structure like this:{"objectSchema": {"fields": [ {"name": "OBJECTID","type": "esriFieldTypeOID","alias": "OBJECTID","domain": null,"editable": false,"nullable": false,"defaultValue":...
View ArticleFlatten and filter multi-dimension JSON with JQ
I have the following JSON test.json:[ {"status": {"+@state": "up" },"address": {"+@addr": "10.10.10.1","+@addrtype": "ipv4" },"ports": {"port": [ {"+@protocol": "tcp","+@portid": "80","state":...
View ArticleHow to map array of object to object key-value pairs in JQ?
Using JQ how do I convert array of objects to key-value pair object?Given the JSON:[ {"name": "foo","id": "123" }, {"name": "bar","id": "456" }]Desired output:{"foo": "123","bar": "456"}
View ArticleJSON Query - 'jq' how do I get / update an object from an array or list
I have the below code in which I need to get/update the values of an object. I am able to get jq -r .settings.tasks What I need is to get and update values of base_parameters under notebook_task and...
View ArticleHow do I reference a step's "with:" property in workflow YAML?
I'm using dorny/paths-filter to detect changes. The problem is I want to run a success job for each of the unchanged filters. This way I can enforce waiting for all jobs in GitHub's rules.My workflow...
View ArticleReplace a field with the index of values in an array in JQ
Given the following JSON file:{"quadrants": ["Languages + Frameworks","Tools","Platforms","Techniques" ],"entries": [ {"quadrant": "Languages + Frameworks" }, {"quadrant": "Platforms" }, {"quadrant":...
View ArticleJSON conversion error from aws configservice query
I have a problem generating the list of my resources in AWS, and later converting them into CSV using the JQ command, exactly this is the command I am running from the AWS CLIaws configservice...
View ArticleHow to sort a json file by keys and values of those keys in jq
We're building a website using the Pentaho CTools library, which has a graphical dashboard editor which writes out JSON-format files for part of the dashboard.I'd like to apply a transform to these...
View Articlecomparing json data failing when using jq? [closed]
I have a shell script. In the script, i am comparing json in a variable against another json in a file . The following is my sample code snippet.RESPONSE=$(curl --connect-timeout 1 -s -f -X POST -H...
View Articlejq: get first n elements of an array field
I'm getting some issues trying to get only firsts 3 elements of an array:json is like...
View Articlehow to get response from below jq data as response using jqs CE2-DG Group-id...
i want to create a map usin gbelow mentioned dataI have below data want to get response likeCE2-DG Group-id(CE2-LAG1, CE4-LAG1) using JQs{"Swagatha": [ {"a": false,"b": "CE2-DG","c" : "Swagatha","d":...
View ArticleHow do I pass JSON to a Postgres COPY tmp FROM PROGRAM command
I'm trying to use Postgres (PL/pgSQL) to communicate with a shell script that expects JSON data. A simplified example of what I'm trying to do isCREATE OR REPLACE FUNCTION json_func(IN json_in JSONB,...
View ArticleValue map with JQ
I've a large JSON file where I'd like to transform some values based on some kind of mapping.The data I have looks like:[ {"id":1, "value":"yes"}, {"id":2, "value":"no"}, {"id":3, "value":"maybe"}]And...
View ArticleReplace single backslash with double backslash so that json becomes parseable
I am using cURL inside bash to fetch json data from remote API. Also using jq to parse and loop through the json array to perform additional operations. The response looks like this:[ {"services":...
View ArticleJQ Parsing a json stream input - Amazon Firehose
0Hello,I have a json stream coming into my aws firehose that can contain either metrics or report key-value pairs based on the data source. They look like this -metrics stream{ "metric": { "k1" : "v1",...
View ArticleJQ extract parent folder
I have an s3 route and I have to split it in bucket, prefix and key using JQ."s3://bucket/folder1/folder2/folder3/key.txt" ->{ bucket: bucket, prefix: folder1/folder2/folder3, key: key.txt}
View Article