in Education by
Say I have input like {"DESCRIPTION": "Need to run script to do stuff", "PRIORITY": "Medium"} but also get input like {"STACK_NAME": "applecakes", "BACKEND_OR_INTEGRATIONS": "integrations", "PRIORITY": "Medium"} ie, the parameters can be completely different. I need to get the output in a format more friendly to send to Jira to make tickets. Specifically, I would like to strip the json formatting away, and insert a \n between each keypair. Here's what the above samples should look like: DESCRIPTION: Need to run script to do stuff\nPRIORITY: Medium STACK_NAME: applecakes\nBACKEND_OR_INTEGRATIONS: integrations\nPRIORITY: Medium There can be a little flexibility in that if, for example, more spaces were needed or whatever. So far I've got this worked out (assuming my input is stored in a variable called description echo $description | jq -r "to_entries|map(\"\(.key)=\(.value|tostring)\")|.[]" This works to strip away the JSON formatting, but doesn't handle newlines. I'm stumped on how to make sure I split only on each keypair, not on say every space or anything equally messy. What do I need to add to include newlines? Is a map even my best choice? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Just join what the array of strings with \\n (the sequence of the \ character which we need to escape and the n character) and use raw-output : jq --raw-output 'to_entries | map("\(.key) : \(.value)") | join("\\n")' Try it here.

Related questions

0 votes
    Say I have input like {"DESCRIPTION": "Need to run script to do stuff", "PRIORITY": "Medium"} ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    Say I have input like {"DESCRIPTION": "Need to run script to do stuff", "PRIORITY": "Medium"} ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am trying to replace all characters that are not C, T, A or G with an N in the sequence part ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
+1 vote
    Describe the newline escape sequence with a sample program?...
asked Nov 8, 2020 in Technology by JackTerrance
0 votes
    I want to create a new list from the existing two lists that will have all the matches from list 2 which has an exact ... *", i) in a] Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    I've recently read this article on using printf and scanf in assembly: Meaning of intfmt: db "%d" ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    How can I remove the last character of a string in a newline, In perl I used chomp function what's equivalent to that in Python? Select the correct answer from above options...
asked Jan 21, 2022 in Education by JackTerrance
0 votes
    I would like to know the relation between the mapreduce.map.memory.mb and mapred.map.child.java.opts parameters. ... .child.java.opts? Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    What is the difference between Set and Map in JAVA?...
asked May 26, 2021 in Technology by JackTerrance
0 votes
    What is the difference between heat map and treemap of Tableau?...
asked Oct 30, 2020 in Technology by JackTerrance
0 votes
    I have a REACTSjs application and am trying to solve a problem with localization. I receive some text from ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    Hey there Stack Overflow. I'm trying to build a testing script that should mix outputting changing ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    I have a given list of string and a list of characters and I want to check the string with ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    I'm working on designing a prestashop theme, and I have a problem with the smarty template engine. I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I'd like to do something like outputIdentity.Claims.Add(new Claim("Claim1", "Hi")) However the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
...