Check for duplicate keys in a json file
I have a json file with the following contents: { "id1": { "key": "value" }, "id2": { "key": "value" } } I want to check that each top level key ie. id1, id2 is present only once in a file…
I have a json file with the following contents: { "id1": { "key": "value" }, "id2": { "key": "value" } } I want to check that each top level key ie. id1, id2 is present only once in a file…
I am using JQ Play. Here is my JSON Data - { "body": { "name": "DATATYPES", "primarykey": [ "db_number" ], "members": [ { "name": "db_number", "type": "NUMBER" }, { "name": "db_date", "type": "DATE" }, { "name": "db_timestamp", "type": "TIMESTAMP(6)" },…
I'm trying to get a human-readable representation of thread siblings. I have following output: output. undercloud) [stack@undercloud ~]$ os baremetal introspection data save compute0 |jq '.numa_topology.cpus[] | select(.numa_node == 0) | .thread_siblings' [ 11, 51 ] [ 9, 49 ]…
Here is my input: { "alias-name": "soufriere", "member-entry": { "alias-entry-name": [ "21:00:f4:e9:d4:50:56:7e", "21:00:f4:e9:d4:50:56:7f" ] } } { "alias-name": "stromboli", "member-entry": { "alias-entry-name": [ "21:00:f4:e9:d4:50:56:8e" "21:00:f4:e9:d4:50:56:9e" ] } } I'd like to turn this into output alicreate "soufriere","21:00:f4:e9:d4:50:56:7e;21:00:f4:e9:d4:50:56:7f" alicreate "stromboli","21:00:f4:e9:d4:50:56:8e;21:00:f4:e9:d4:50:56:9e" I…
here is original json example: { "item1": { "foo1": 1, "foo2": 2 }, "item2": { "foo1": 11, "foo2": 22 } } how can i convert it into json array with new attribute using jq: [ { "name": "item1", "foo1": 1,…
I have a json like bellow: [ { "name": "architecture-design-detailed", "rootPath": "/media/ismail/architecture-design-detailed/_Working/_NotesFiltered/_software/architecture-design-detailed", "paths": [], "group": "", "enabled": true }, { "name": "architecture-design-detailed-engineering", "rootPath": "/media/ismail/architecture-design-detailed/_Working/_NotesFiltered/_software/architecture-design-detailed-engineering", "paths": [], "group": "", "enabled": true } ] If name is architecture-design-detailed, change name to new_name_here…
Can anyone help me using bash and jq to be able to filter this JSON down to only the first occurrence of the user.login for each item, with the highest submitted_at key. An endpoint is giving me back historical information…
I have a json file as below { "requestData": { "username": "admin" }, "eventTime": "2023-12-01T23:50:02.554+0000", "observer": { "id": "target" } I want to get only the below output side by side,O/P "username": "admin","eventTime": "2023-12-01T23:50:02.554+0000" I tried using below but, able…
I am currently working with i3 and would like to parse the visible workspaces with i3-msg -t get_workspaces, to "save the workspace" and return to them when my pomodoro break is over, problem is I've never worked with json in…
I have a JSON object that contains a JWT token. I would like to extract the claims from the token and put them into the JSON object, replacing the token. Here is my object: { "id": 7, "time": "now", "token":…