Skip to main content

Questions tagged [json]

JSON (JavaScript Object Notation) is a lightweight data representation format that resembles JavaScript source and that is can be easily red by machines and edited by humans with some effort.

Filter by
Sorted by
Tagged with
1 vote
2 answers
85 views

bash 4.4.20 and jq-1.6 on RHEL8 I get this nice output from jq and column. Hard to read, though. pgbackrest info --output=json \ | jq -r '.[] | .backup[] | "\(.type) \(.label) \(.info.delta)...
RonJohn's user avatar
  • 1,483
0 votes
0 answers
66 views

I'm on Fedora Linux 42.20250824.0 (Sway Atomic), running libvirt version 11.0.0, qemu-img version 9.2.4 (qemu-9.2.4-1.fc42) and virt-manager version 5.0.0, all installed as layered packages. Using ...
magnusTre's user avatar
0 votes
2 answers
221 views

Consider a contrived example using a JSON object such as this, where I want to extract the related id, firstname, and lastname fields for each of many array objects into shell variables for further (...
Chris Davies's user avatar
2 votes
1 answer
89 views

I am attempting to edit an OpenAPI specification by changing all parameters to be nullable. A parameter definition looks like this: { "name": "foo", "required": ...
miken32's user avatar
  • 607
8 votes
3 answers
1k views

Say, I provide jq with the following JSON body as input: {"person1": {"name": "foo"}, "person2": {"name": "bar"}} Is it possible to have jq ...
Shuzheng's user avatar
  • 5,019
5 votes
2 answers
410 views

I'm using an API (from SyncroMSP) that returns paginated JSON data. I can obtain the number of pages, and I can obtain the data with a tool such as curl. Each chunk is valid JSON but it only contains ...
Chris Davies's user avatar
6 votes
2 answers
393 views

I have a huge JSON object with an array of objects inside it. I have to add key:value pair to a specific object in the array. For example, let the input object is: { "a": { "b&...
Vlado B.'s user avatar
3 votes
1 answer
338 views

I want to output a specific key of list of a list of hashes as lines where each outer array item is separated by an empty line. To illustrate: Input is: [ [ { "visible": true, ...
Orangenhain's user avatar
0 votes
1 answer
121 views

I have given sets of different input files as shown sample below cat out.txt [ { "regional_unit": "node", "source_name": "1753250187_SPS", "...
Vikrant Singh Rana's user avatar
0 votes
3 answers
413 views

I have a json object that has an unknown number of variables, like this: { "var1": 123, "var2": 456, "var3": 789 } How can I automatically convert it to form ...
teeeeee's user avatar
  • 305
1 vote
1 answer
79 views

how do I get jq to take json like this: { "responseHeader":{ "status":0, "QTime":1 }, "cluster":{ "collections":{ "...
Claudio Favaro's user avatar
3 votes
2 answers
2k views

I sometimes need to write JSON strings containing a string value that is itself a JSON string. e.g. In the following JSON object: echo '{"rec" : " {\"id\": 1, \"name\&...
tinlyx's user avatar
  • 1,086
3 votes
2 answers
2k views

$ n="foo"; echo "{}" | jq --arg n "$n" '. += { "$n": $n }' { "$n": "foo" } My reading of https://jqlang.github.io/jq/manual/#types-and-...
Richard Barraclough's user avatar
-2 votes
3 answers
166 views

I am trying to get the job status from the below json file.. but while using awk it is returning { "id": 10870, "type": "job", "url": "/api/v2/...
user984993's user avatar
3 votes
2 answers
722 views

I recently discovered jq and gron. For my use case, gron is sufficient, but I am a little worried by lack of development. There are some bugs that have not been addressed in an year, while I see that ...
Francesco Potortì's user avatar
0 votes
4 answers
157 views

I'm trying to replace "}," by "}" from the last line of a file : My /etc/firefox/policies/policies.json file like this because I added the certificate lines using a for loop : $ ...
SebMa's user avatar
  • 2,473
-1 votes
1 answer
238 views

How can I update a json file using jq in a loop as below ? json file need to have the .queryToken updated and .result array appended using json in curl response body while true do curl -k --location ...
Anil Samuel's user avatar
3 votes
2 answers
387 views

[ { "key": "@timestamp", "value": "2024-08-21 03:02:57.871" }, { "key": "@message", "value": "Aug 21, ...
Anil Samuel's user avatar
1 vote
1 answer
310 views

I have a couple of hours (I started today) experience in Bash. I have been trying multiple times to modify the value from a key in a json file using it. I know that it's much easier in python but I ...
Diego Alejandro Gómez Pardo's user avatar
-2 votes
1 answer
513 views

I have a a large number of JSON files on a Linux machine, where I need to change the value of a parameter with value taken from a different text file. E.g.: If the JSON file has values like: { "...
vishal's user avatar
  • 97
-2 votes
2 answers
157 views

I have json file like this: { "sdpSemantics": "unified-plan", "iceServers": [ { "urls": "stun:1.1.1.1:3478" }, { "...
user613400's user avatar
5 votes
2 answers
620 views

I have a series of events represented in a JSON array. I want to move data in the fields of earlier events to a later event. Is there a way to do this with jq? Here is an example of what I'm looking ...
ralmond's user avatar
  • 51
7 votes
3 answers
2k views

I'd like to prepare a test for a REST petstore server by the mean of curl. To test its add new pet api, I prepare a json string that holds the Pet to insert in a bash function that executes the curl: #...
Marc Le Bihan's user avatar
9 votes
1 answer
2k views

I wanted to use jq to get a specific value b from two possible paths (and these two only). So, basically, I wanted to say jq '(path1 OR path2) | .b' which should work if b is at one of the two paths ...
tinlyx's user avatar
  • 1,086
0 votes
2 answers
469 views

I have a shell script part of which is the following JSON: curl --request POST \ --url 'https://'$jira_instance'.atlassian.net/rest/api/2/field/'$field_ID'/context/'$context_ID'/option' \ --user $...
dlyk1988's user avatar
  • 103
4 votes
2 answers
3k views

The default functionality of jq is to send each object from an array one at a time, though the join operator can merge those values. My problem is in trying to print all the values from multiple ...
T145's user avatar
  • 223
6 votes
2 answers
2k views

I'm tracking the configuration of some system in JSON format in a revision control system. Unfortunately that configuration is retrieved using some closed-source proprietary command, and the output ...
Stéphane Chazelas's user avatar
7 votes
2 answers
2k views

To be clear - I want a pseudo-JSON output that will be written into another static JSON file here... so not wrapped in an array or anything, simply getting the missing commas after each entity in my ...
Seer's user avatar
  • 175
1 vote
2 answers
871 views

I'm pretty sure this isn't possible, but I have been wrong in the past. Basically, what I'd like to do is take the JSON output from a curl command and pipe it to jq for prettiness. Which works fine. ...
supradave's user avatar
-1 votes
5 answers
182 views

How to check the contents of an entire file for compliance with the pattern \s*{\s*}\s* using busybox? You need to check the entire file from beginning to end, and not individual lines, as grep does. ...
Maxim's user avatar
  • 119
0 votes
5 answers
221 views

There is a file with contents { "first_name": "John", "last_name": "Smith", "is_alive": true, "age": 27, "address": { ...
Maxim's user avatar
  • 119
0 votes
1 answer
2k views

I have a json string formatted displayed in a web page. What I am trying to understand is what is the size in terms of bytes that this json string requires. If I copy and pipe to wc -c I get 1000 ...
Jim's user avatar
  • 1,499
1 vote
1 answer
168 views

I have the below JSON document from the Junos REST API. I am trying to simplify the document down to just a select few items. How would I accomplish this? Expected JSON: [ { "status": ....
verideskstar's user avatar
-1 votes
1 answer
358 views

I've had to deal with case I need the JSON format data of lscpu output, but -J key hasn't supported. So I made simple command line script allows to transform plain output to JSON which I'll post here ...
Aleksey's user avatar
  • 75
1 vote
2 answers
954 views

Team, I am unable to substitute values inside json(myjson) to use in curl command. any hint? JENKINS_USERNAME="svc-user" JENKINS_USER_TOKEN="xxxx" JENKINS_INSTANCE_FQDN="sham....
AhmFM's user avatar
  • 135
1 vote
3 answers
458 views

I have a large table of data that I would like to convert to json and am not sure if a tool like jq, mlr, or similar would be able to perform such a task without having to resort to my poor awk skills....
jesse_b's user avatar
  • 41.6k
1 vote
2 answers
337 views

I search for an object with a specific property and then update another property. Given this input: [ { "replacements": [ { "newValue": "0", &...
Jazzschmidt's user avatar
2 votes
1 answer
384 views

I have the following JSON file named pool.json: { "AllocateActions": {}, "Available": true, "Description": "Pool for nodes in cluster - {{CLUSTER_NAME}}&...
aneeshdevcube's user avatar
-1 votes
1 answer
75 views

so I'm new to Shell Scripting and could use some help. So in my CSV file, I want to see if IP and timestamp values exists in some way in the line entries of the JSON log file, and if so, return that ...
Linuxnoob's user avatar
2 votes
4 answers
3k views

I know many have asked similar questions, but I can't make it work. I have a file called Dependencies: Accounts Aggregates Blog Configuration Contacts Contents DataTypes Forms Geo Globalization Media ...
Saeed Neamati's user avatar
1 vote
1 answer
2k views

I've asked a similar question in the past but I'm having a hard time adapting that solution to this problem. I have the following json array: $ jq <<<"$json" [ { "id"...
jesse_b's user avatar
  • 41.6k
0 votes
3 answers
1k views

I used jq to convert an array of words into an argument for a java program. its like arguments=$(jq '.nameField | "-i " + "\"" + . + "\""' file.json) java .... ...
decipher's user avatar
  • 362
-2 votes
1 answer
74 views

I have a huge text file that contains this structure: title;description;date The problem is that description main contain paragraphs, like: title;description;data MyText;Lorem ipsum dolor sit amet, ...
Duck's user avatar
  • 4,814
9 votes
3 answers
6k views

A large (and growing) number of utilities on Unix-like systems seem to be choosing the JSON format for data interchange¹, even though JSON strings cannot directly represent arbitrary file paths, ...
Stéphane Chazelas's user avatar
1 vote
1 answer
58 views

The below is my json code [ { "kind": "user", "version": "v2", "metadata": { "name": "person1" }, "...
code userit's user avatar
0 votes
2 answers
224 views

Here is a JSON response I am receiving from a server: { "GoUZm0F3r-rZ0tItdurVfPLCAfBGrnvF32": { "entityId": "GoUZm0F3r-rZ0tItdurVfPLCAfBGrnvF32", &...
Ashish's user avatar
  • 1
0 votes
2 answers
754 views

curl --request POST \ --url 'https://bankofloyal.atlassian.net/rest/api/2/issue' \ --user [email protected]:$JIRA_TOKEN \ --header 'Accept: application/json' \ ...
Abhishek Kumar's user avatar
0 votes
1 answer
1k views

I have some JSON: { "Data": { "$id": "1", "voters": { "$id": "2", "$values": [ { "$id&...
Joel Breazeale's user avatar
0 votes
1 answer
63 views

Hello, I have an englishStrings.json file and when I make new edits/ additions to it, I need to copy the new changes to all the other language string.json files. Before making any changes to ...
Freezer Fridge's user avatar
0 votes
1 answer
494 views

I have a system that outputs multiple types of JSON files with data. Is there any chance to implement the three conditions below using jq? I am exploring the map() command, and the --arg and --argjson ...
infotechsups's user avatar

1
2 3 4 5
12