Skip to content

Add --fields to project top-level response fields across all formats #281

Description

@jongio

Problem

Trimming a response to a few fields requires a verbose JMESPath projection that depends on the response shape. --table-columns only affects table rendering, not the json, yaml, csv, or piped output.

Solution

Add --fields <a,b,c> that keeps only the listed top-level fields. It applies to a single object, to each element of an array, and to each element of an ARM value[] wrapper (keeping the wrapper so paging links survive). It runs after --query and before formatting, so every output format and downstream pipe sees the trimmed data.

Acceptance criteria

  • An object keeps only the listed keys
  • An array of objects trims each element
  • An ARM value[] response trims each value element and keeps the wrapper
  • Works with --format json, table, csv, and yaml
  • A non-JSON response is left unchanged with a note on stderr
  • Unit tests and CLI reference docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestideaFeature idea from the idea pipeline

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions