Json – JQ extract parent folder
I have an s3 route and I have to split it in bucket, prefix and key using JQ. "s3://bucket/folder1/folder2/folder3/key.txt" -> { bucket: bucket, prefix: folder1/folder2/folder3, key: key.txt }
I have an s3 route and I have to split it in bucket, prefix and key using JQ. "s3://bucket/folder1/folder2/folder3/key.txt" -> { bucket: bucket, prefix: folder1/folder2/folder3, key: key.txt }
I am using cURL inside bash to fetch json data from remote API. Also using jq to parse and loop through the json array to perform additional operations. The response looks like this: [ { "services": [ "HOM" ], "specialServiceId":…
Given the following JSON file: { "quadrants": [ "Languages + Frameworks", "Tools", "Platforms", "Techniques" ], "entries": [ { "quadrant": "Languages + Frameworks" }, { "quadrant": "Platforms" }, { "quadrant": "Languages + Frameworks" } ] } How can the quadrant field…
I have the following JSON test.json: [ { "status": { "+@state": "up" }, "address": { "+@addr": "10.10.10.1", "+@addrtype": "ipv4" }, "ports": { "port": [ { "+@protocol": "tcp", "+@portid": "80", "state": { "+@state": "open" } }, { "+@protocol": "tcp", "+@portid": "443",…
Using JQ how do I convert array of objects to key-value pair object? Given the JSON: [ { "name": "foo", "id": "123" }, { "name": "bar", "id": "456" } ] Desired output: { "foo": "123", "bar": "456" }
I have a JSON structure like this: { "objectSchema": { "fields": { "fieldArray": [ { "a": "b", "c": "d" }, { "x": 1, "y": "z" }, { "x": 1, "y": "z" } ] } } } My current jq -…
I am having a shell script . in my shell script i have a command that returns the following data as a json . { "remoteIds": [ { "remoteId": "[fd00:10:244:1:0:0:0:12]--(http://fd00-10-244-1--12.nspace.pod:8080)", "requestsReceived": 1 } } i want to validate the above…
I am having a shell script file validation-example.sh , it has the followign content expected_template = '{ "remoteIds": [ { "remoteId": "", "requestsReceived": 1 }, { "remoteId": "", "requestsReceived": 1 }, { "remoteId": "", "requestsReceived": 1 }, { "remoteId": "",…
With jq command, I want to merge multiple json files. But I have no idea how to achieve below expectation. thanks in advance a.json { "key1": { "key2": [ 1, 2 ] }, "key3": "aaa" } b.json { "key1": {…
Suppose I have this dataset: {"id": 99, "labeled_values": [["one", "green"], ["two", "red"], ["three", "blue"]], "flavors": ["hot", "cold"]} {"id": 100, "labeled_values": [["four", "green"], ["five", "red"]], "flavors": ["hot"]} and I would like this output (tab-separated): 99 one green hot 99 two red…