skip to Main Content

How to get parent element reference in a JSON query?

I have the following json: { "virtual_machines": [ { "guest_name": "guest1", "mac_address": [ "00:01:02:03:04:05" ], "vm_network": { "00:01:02:03:04:05": { "ipv4": [ "192.168.2.23" ], "ipv6": [ "fe80::896:2e12:c059:4237" ] }, "c2:e3:7c:ac:60:c5": { "ipv4": [ "10.42.0.0" ], "ipv6": [] }, "5a:00:fb:5e:3d:65": { "ipv4":…

VIEW QUESTION

Can JSON Files be merged with Bash or JQ?

I've got two files containing compressed JSONs. All JSONs having the same root fragments "id" and "test": file1.json: {"test":{"a":2},"id":"850303847"} {"test":{"a":3},"id":"2742540872"} {"test":{"a":4},"id":"1358887220"} file2.json: {"test":{"b":3},"id":"850303847"} {"test":{"b":3},"id":"2742540872"} {"test":{"b":4},"id":"1358887220"} file3.json {"test":{"c":8},"id":"850303847"} {"test":{"c":4},"id":"2742540872"} {"test":{"c":5},"id":"1358887220"} I would like to merge these Files based on it's IDs…

VIEW QUESTION
Back To Top
Search