Skip to content

JSON output of list commands isn't an array #438

Closed
@jgeorgeson

Description

@jgeorgeson

Each object is returned as distinct JSON object instead of all the objects being contained in an array. For example listing MRs

gitlab -o json project-merge-request list --state merged --project 'mygroup%2fmyproj'

Expected (ie what GitLab returns with equivalent curl request):

[
  { "id":1234, "iid": 1, "project_id": 5, ...},
  { "id":1235, "iid": 2, "project_id": 5, ...},
  { "id":1236, "iid": 3, "project_id": 5, ...}
]

Actual:

{ "id":1234, "iid": 1, "project_id": 5, ...}
{ "id":1235, "iid": 2, "project_id": 5, ...}
{ "id":1236, "iid": 3, "project_id": 5, ...}

This makes any existing scripting based on incompatible (ie jq '.[]|select(...).id' has to be rewritten as jq 'select(...).id').

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions