DEV Community

2

List non-empty fields of Jira ticket

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

$ jiraGet issue/BOOM-666 > jiraIssue.json
Enter fullscreen mode Exit fullscreen mode

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>...
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay