Questions tagged [jq]
The jq tag has no usage guidance.
9
questions
0
votes
2
answers
1k
views
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 ...
0
votes
2
answers
637
views
Get outputs from jq specific line
The command:
create_subnet=$(aws ec2 create-subnet --vpc-id "$create_vpc" --cidr-block 10.0.1.0/24 | jq -r '.subnet[].subnetid')
The output:
"subnet": {
"...
0
votes
1
answer
87
views
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 '.instance.id' ./$file)
echo $instanceid
done
$...
1
vote
1
answer
610
views
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 ...
0
votes
1
answer
147
views
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&...
-1
votes
1
answer
729
views
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 ...
3
votes
1
answer
4k
views
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....
3
votes
1
answer
5k
views
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": "...
0
votes
1
answer
91
views
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 ...