Select objects based on value of variable in object using jq

I have the following json file: { "FOO": { "name": "Donald", "location": "Stockholm" }, "BAR": { "name": "Walt", "location": "Stockholm" }, ...

Add a minute to hh:mm with JavaScript

I'm a PHP programmer who seldom uses Javascript, so I need help figuring out how to accomplish this with JS or JQuery (I currently have jquery-1.7.min.js). I've created three clocks showing the...

Coloring JSON output in python

In python, If I have a JSON object obj, then I can print json.dumps(obj, sort_keys=True, indent=4) in order to get a pretty printout of the object. Is it possible to prettify the output even...

Terminating jq processing when condition is met

I am using jq to search for specific results in a large file. I do not care for duplicate entries matching this specific condition, and it takes a while to process the whole file. What I would...

How to change the position of buttons in DataTables

I have the following codes: var dataSet = [ ["Airi Satou", "Accountant", "Tokyo", "5407", "2008/11/28", "$162,700"], ["Angelica Ramos", "Chief Executive Officer (CEO)", "London", "5797",...

Install jq JSON processor on Ubuntu 10.04

Is there a way to install jq JSON processor on Ubuntu 10.04? I Tried the usual sudo apt-get install jq but got the error E: Couldn't find package jq

Iterating through JSON array in Shell script

I have a JSON data as follows in data.json file [ {"original_name":"pdf_convert","changed_name":"pdf_convert_1"}, {"original_name":"video_encode","changed_name":"video_encode_1"}, ...

Convert a JSON array to a bash array of strings

How do I parse a json array of objects to a bash array with those objects as strings? I am trying to do the following: CONVO=$(get_json_array | jq '.[]') for CONVERSATION in...

Jq to replace text directly on file (like sed -i)

I have a json file that needs to be updated on a certain condition. Sample json { "Actions" : [ { "value" : "1", "properties" : { "name" : "abc", ...

How 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.

How can I completely sort arbitrary JSON using jq?

I want to diff two JSON text files. Unfortunately they're constructed in arbitrary order, so I get diffs when they're semantically identical. I'd like to use jq (or whatever) to sort them in any...

How to format a JSON string as a table using jq?

Just started out with Bash scripting and stumbled upon jq to work with JSON. I need to transform a JSON string like below to a table for output in the terminal. [{ "name": "George", "id":...

Ignore Unparseable JSON with jq

I'm using jq to parse some of my logs, but some of the log lines can't be parsed for various reasons. Is there a way to have jq ignore those lines? I can't seem to find a solution. I tried to use...

How to check if element exists in array with jq

I have an array and I need to check if elements exists in that array or to get that element from the array using jq, fruit.json: { "fruit": [ "apple", "orange", ...

AWS CLI: ECR list-images, get newest

Using AWS CLI, and jq if needed, I'm trying to get the tag of the newest image in a particular repo. Let's call the repo foo, and say the latest image is tagged bar. What query do I use to return...

Crawl menu (according to hierarchy) with Scrapy

The goal is crawl an e-commerce menu and return all categories respecting taxonomy levels (N1, N2 and N3). I´m getting good results but N3 categories are shown last and separately on the output...

API Gateway Mock Integration Fails with 500

I have an API Gateway integration for a method/resource which works when I call it from the API but not when I actually call it: $ aws apigateway test-invoke-method --rest-api-id $REST_API_ID \ ...

How to remove double-quotes in jq output for parsing json files in bash?

I'm using jq to parse a JSON file as shown here. However, the results for string values contain the "double-quotes" as expected, as shown below: $ cat json.txt | jq '.name' "Google" How can I...

Converting CSV to JSON in bash

Trying to convert a CSV file into a JSON Here is two sample lines : -21.3214077;55.4851413;Ruizia cordata -21.3213078;55.4849803;Cossinia pinnata I would like to get something like...

jq count the number of items in json by a specific key

The following is the first two items in my json file { "ReferringUrl": "N", "OpenAccess": "0", "Properties": { "ItmId": "1694738780" } } { "ReferringUrl": "L", "OpenAccess":...

How to capture clicked element using $(this) inside of a vue(js) instance

I am reworking an old app of mine and I am having issues with dom manipulation and basic selections within a vue instance. Essentially I have information in a database that I load in via...

Filter empty and/or null values with jq

I have a file with jsonlines and would like to find empty values. {"name": "Color TV", "price": "1200", "available": ""} {"name": "DVD player", "price": "200", "color": null} And would like to...

Where a binary inside a JavaScript module should live?

I'm the creator of node-jq. That's just a wrapper around jq and the ability to call to jq functionality inside node. The idea of node-jq is to download and build on install-time the binary of jq...

How do I pass literal variable templates to jq from within Make?

I'm trying to use jq within a Makefile to generate a json file. Here is a sample Makefile foo.json: jq -n --arg x "bar" '{"foo": "$$x"}' > foo.json @cat foo.json @rm foo.json When I...

Is jq installed and available on PATH?

I am trying to read a yaml file in gitlab CI. I installed jq==1.0.2 and yq==2.10.1 using pip in my CI job and I use python:3.7 image. When I tried to read the yaml file, it has the error yq: Error...

Selenium.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED

I am trying to user latest selenium hub in docker and try to run pytests in docker or without it for debug. I set up selenium according to official documentation. I used 3 version for docker...

Getting pdf file from api response

I am calling an api and getting pdf in return. fetch(`api` + guid, { method: "GET", headers: { "Accept": "application/octet-stream", "Authorization": "Bearer " + token, }, ...

Nifi image Not Running over openshift

While trying to run docker image of apache nifi present in the docker hub in the open shift, it is giving me the permission issue as the docker image was running the user nifi which is not allowed...

Set xdebug.mode to coverage in Azure DevOps pipeline

I need to set xdebug.mode to coverage to run unit test in Azure Pipeline. I have tried to set it manually using this task: - script: | sudo update-alternatives --set php...

How to set environment variables from platform hooks in elastic beanstalk?

I am trying to deploy a django application using elastic beanstalk. The app connects to the database using the environment variables. DATABASES = { 'default': { 'ENGINE':...