feat: Add JSON (Human Readable) Output #909
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add JSON Output Support with Field Filtering
What does this PR solve?
Adds comprehensive JSON output support for
jira issue listandjira issue viewcommands with three complementary features:--json)--json-filter)--api-fields)While each of these is a feature in their own right - I think they belong together in a single PR since they build on each other. For simpler review, each of these is implemented in a distinct and self-contained commit. If you'd like me to restructure it - please ask :)
Try It
Problem 1: Illegible JSON with Custom Field IDs
Jira's
--rawAPI returns custom fields with IDs likecustomfield_123123123instead of meaningful names likestoryPoints, making the JSON difficult to parse for humans, scripts, and AI agents.Solution: New
--jsonflag that:customfield_xxxxxxinto readable camelCase names (e.g., "Story Points" →storyPoints, "Developer" →developer)~/.config/.jira/.config.ymlExample:
Problem 2: Custom Field Name Collisions and Imprecise Output Filtering
Multiple custom fields with similar names can conflict in camelCase output (e.g., "My Chapter" and "My-Chapter" both become
myChapter). Additionally, you may want to filter to specific nested fields (e.g., juststatus.statusCategory.name) rather than the entire status object.Solution: New
--json-filterflag with smart collision handling:fields.status.statusCategory.name)nullvalues when explicitly requestedExamples:
Problem 3: Inefficient API Calls
By default, Jira returns ALL fields for an issue, which is slow and wasteful when you only need a few specific fields.
Solution: New
--api-fieldsflag that:customfield_12310243)key,summary), custom field names, custom field IDs, and wildcards (*navigable,*all)--jsonand--rawoutput formats--json-filterfor maximum efficiency and precisionExamples:
Note: For
jira issue list, the--api-fieldsparameter can only reduce fields returned by the Jira search API, not add new ones (Jira API limitation).Known Issues
While developing this feature, I discovered that
jira epic listandjira sprint listinherit the--jsonand--rawflags due to how commands are structured, but these flags don't work correctly for those commands. This is an existing bug that also affects--raw. I'm not fixing it here to keep the PR focused.Credits
This PR was co-authored by Claude AI.