Quick JQ Example
gist: Quick jq example
File: getNames.bat
1
2
3
@echo off
rem use -r to return strings without surrounding double-quotes
jq -r ".Buckets | .[] | .Name" s3.json
File: s3.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
"Buckets": [
{
"Name": "examplelogs",
"CreationDate": "2018-07-11T15:35:14.000Z"
},
{
"Name": "example.net",
"CreationDate": "2019-11-17T11:36:46.000Z"
},
{
"Name": "s3.example.net",
"CreationDate": "2018-07-17T18:16:37.000Z"
},
{
"Name": "example2.io",
"CreationDate": "2019-11-12T15:46:34.000Z"
},
{
"Name": "example3.com",
"CreationDate": "2018-07-18T02:33:46.000Z"
},
{
"Name": "www.example.net",
"CreationDate": "2019-11-17T11:35:25.000Z"
},
{
"Name": "www.example2.io",
"CreationDate": "2019-11-12T15:43:29.000Z"
},
{
"Name": "www.example3.com",
"CreationDate": "2018-07-18T02:34:20.000Z"
}
],
"Owner": {
"DisplayName": "example",
"ID": "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
}
}