Questions tagged [jq]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers

jq: error: X/0 is not defined at <top-level>, line 1:

I'm trying to extract value from the bellow JSON: % export test='{"a-b-c":"x-y-z"}' % echo $test {"a-b-c":"x-y-z"} % echo $test | jq .a-b-c jq: error: b/0 is ...
alexus's user avatar
  • 13.1k
0 votes
2 answers

Get outputs from jq specific line

The command: create_subnet=$(aws ec2 create-subnet --vpc-id "$create_vpc" --cidr-block | jq -r '.subnet[].subnetid') The output: "subnet": { "...
rikorey's user avatar
  • 15
0 votes
1 answer

Shell script not reading the file as expected

Below is the script trying to be executed: read n for ((i=1;i<=$n;i++)) do file=createserver"$i".json echo $file instanceid[$i-1]=$(jq -r '' ./$file) echo $instanceid done $...
serverstackqns's user avatar
1 vote
1 answer

Issues with converting JSON to CSV with nested values

So far I have had no problems converting standard JSON to CSV with jq in the past. But now my data becomes complicated. Major base tags are account and subaccount. All other values are variables. The ...
safect's user avatar
  • 13
0 votes
1 answer

Transform each item in a JSON array to a JSON object

I need to transform this simple JSON array: ["169","19","33"] to a more complicated JSON object for each item, like: { "groups": [ { "groupid&...
user5525652's user avatar
-1 votes
1 answer

Can I pipe a "tail -f " with mixed data containg JSONs to jq to visualize JSONs?

I´ve playing for a whilen and resarching but I´m not able to find a solution. I have some huge logs, where sometimes there are also huge JSONS. But to simplify imagine the following: mkdir logs cd ...
nck's user avatar
  • 129
3 votes
1 answer

jq sort by date (iso 8601)

I try to sort json by date (field CreationTimeUTC) in iso 8601 format with jq 1.5. I found this post, but that return : 'Cannot index boolean with string "CreationTimeUTC"' jq '.Entities....
user5525652's user avatar
3 votes
1 answer

jq : Get values from children array and display on parent array [closed]

I try to get theses value : "VmDisplayName, CreationTimeUTC, EndTimeUTC, Reason, Result, State, TotalSize, BackupServerReference, BackupJobSessionReference" from this json : { "JobSessionUid": "...
user5525652's user avatar
0 votes
1 answer

automatically detect an apache server running on a specific vm and zone in Google Cloud Platform

Note: This is a self-answered question, which is allowed here. If you have better solutions go ahead and post them. Hypothetical automation for a web-based cloud school needs to test if students ...
Paul's user avatar
  • 1,634