Merge objects in JSON lists using JQ
I want to merge two JSON files, where the objects in the base file (A) are augmented by matching objects in file (B), but not overwritten where A and B have different values for the same key. For example, I…
I want to merge two JSON files, where the objects in the base file (A) are augmented by matching objects in file (B), but not overwritten where A and B have different values for the same key. For example, I…
I have two JSON files with different schema. The sample data in the JSON files as File1.json { "ServiceSettings": { "ServiceName": "my-service", "RedisSettings": { "RedisHost": "HOST-A;HOST-B" } } } File2.json: { "RedisHost": "HOST-A;HOST-B" } I have a requirement as below…
I want to make a script that will generate a list of certificates that will expire in a month and write it in json format to a file. Making a loop and getting the list as regular strings is not…
I have the following json: [ { "a": 10, "b": 20 }, { "a": 11, "c": 30, }, { "b": 21, "c": 31 } ] And I need to create a new json object with all the keys in the…
Imagine I have two files as below: file1: [ "id1", "id2" ] file2: [ { "id": "id1", "name": "name1" }, { "id": "id1", "name": "name2" }, { "id": "id3", "name": "name3" }, { "id": "id5", "name": "name5" }, { "id":…
I have written a JSON schema file for my Kubernetes Helm values files. The schema defined some required properties. I would like to publish modified schema without all required properties. Background: With helm, it's possible to define a subset of…
I have a JSON data like below [ { "id": 4449282, "iid": 6316, "project_id": 1234, "sha": "abcdefg", "ref": "test_branch", "status": "running", "source": "web", "created_at": "2023-09-25T05:55:20.788Z", "updated_at": "2023-09-25T05:55:23.481Z", "web_url": "https://example.gitlab.com" } ] I want the output to be filtered only with…
I'm trying to get the lastest version of "spip" For that, I can use a JSON output from https://www.spip.net/spip_loader.api but I don't know how to get the 2nd record key (4.2.5) in bash with jq. $ wget -q -O- https://www.spip.net/spip_loader.api…
I have a python script that watches a socket and when data is received it writes JSON to stdout. This sample script below illustrates the behaviour, outputting new JSON every 3 seconds. import json, time def new_json(n): frame = {…
Given the following JSON structure { "data": [ { "id": "000000000014444A", "teams": [ "000000000011AE74" ] }, { "id": "000000000014434B", "teams": [ "000000000011AE74", "00000000001583CE", "000000000010B4D7" ] } ] } How can I use jq to structure the data as [ {…