Category "jq"

parse error: Invalid numeric literal at line 1, column 6

The 1 liner to grab the ticker works fine from commandline, but i get this error running in a script. I run the 1 liner that grabs TICKERD from commandline, th

Use jq to parse key path for each each leaf

(I’m not sure the technical terms to use but can update the question if someone can clarify the terminology I’m lacking for what I'm trying to do. I

How to read each cell of a column in csv and take each as input for jq in bash

I am trying to read each cell of CSV and treat it as an input for the JQ command. Below is my code: line.csv | Line | |:---- | | 11 | | 22 | | 33 | Cod

jq replace part of value in json

I need to replace part of a value from a json output. I could easily do this using sed -i however it would also replace other parts of the file I don't want it

Can I pass a string variable to jq not the file?

I want to convert JSON string into an array in bash. The JSON string is passed to the bash script as an argument (it doesn't exist in a file). Is there a way o

Can I pass a string variable to jq not the file?

I want to convert JSON string into an array in bash. The JSON string is passed to the bash script as an argument (it doesn't exist in a file). Is there a way o

How to limit properties of a JSON object given array of property names using JQ?

Assuming I have the following JSON object (which is just an example): { "foo": 1, "bar": 2, "baz": 3 } And the following JSON array (another example)

jq: find and replace within filter

I return a few json values from an API feed using this command: curl -s -u user:pass -H 'my header' https://example.com/data.json | jq -cr '.[] | {id: .id, con

How do I group values to an array for the same field value in jq?

I have json data that looks like [ { "session": "ffe887f3f150", "src_ip": "81.71.87.156" }, { "session": "fff42102e329", "src_ip": "143.19

How to append json array using jq+shell in a loop?

I can create a json object with an array using jq like this echo '{"input":{"names":[]}}' | jq --arg val "alice" '.input.names[0] += $val'| jq --arg val "bob"

jq how to pass json keys from a shell variable

I have a json file I am parsing with jq. This is a sample of the file [{ "key1":{...}, "key2":{...} }] [{ "key1":{...}, "key2":{...} }] ... each line is a list

How to do double-indirection with jq variables?

How to construct a name of a variable from data and access that variable? For example it should somehow give the content of the alpha-file: jq '$.var"-file"' --

How to convert a json response into yaml in bash

I read data from a json file with jq. I wanna append the results into a yaml file, but I dont get it working. I am quite new to shell programming. My goal is to

Is it possible to include current time stamp in jq command?

I am running a curl rest-api call and try to extra some key/value pairs in UBUNTU. This is my current command: curl ..... | jq -c '{"online": .switches.option

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 oper

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" : {

Exporting JSON to environment variables

If I have a JSON like this, { "hello1": "world1", "testk": "testv" } And I want to export each of these key-value pairs as environment variables, how t

Exporting JSON to environment variables

If I have a JSON like this, { "hello1": "world1", "testk": "testv" } And I want to export each of these key-value pairs as environment variables, how t

Split string into fields in JQ

I have this JSON: {"item":2, "url":"domain/house/23/bedroom"} I'm trying to use jq to obtain this new JSON: {"item":2, "number":"23", "room":"bedroom"} Is it

How to prevent yq removing comments and empty lines?

Here Edit yaml objects in array with yq. Speed up Terminalizer's terminal cast (record) I asked about how to edit yaml with yq. I received the best answer. But