loading...

List non-empty fields of Jira ticket

turbobasic profile image andriy melnyk ╔╬═╚╗╠ ╠╣╔╦╣╚╗ ╔╬╗╚╗╚╝ ・1 min read

Let's assume you have saved payload received using Jira REST API to file jiraTask.json.

$ jiraGet issue/BOOM-666 > jiraIssue.json

You can read more about Super-simple Jira API in


Then you can list non-empty fields of the ticket using the folowing command (make sure you have installed jq before):

$ jq --raw-output '
    .fields | 
    . as $f |
    keys[] | 
    select($f[.] != null)
' jiraIssue.json

...<87 fields listed>...

In my example, the command above lists 87 non-empty fields of Jira ticket. Compare it with total number of fields in the ticket which is 983 😱

Or, if you want to see fields with their values, use the following:

$ jq --raw-output '
    .fields | 
    . as $f | [ 
        keys[] | 
        select($f[.] != null) | 
        { (.): $f[.] } 
    ] | 
    add
' jiraIssue.json

Discussion

pic
Editor guide