Q:

jq - returns plain list instead of json array

The below example returns a plain list instead of a JSON array for this sample JSON
{
  "items": [
    {
      "id": 1,
      "name": "one"
    },
    {
      "id": 2,
      "name": "two"
    },
    {
      "id": 3,
      "name": "tre"
    }
  ]
}

This is the output I want:
[1,2,3]

But I get
1
2
3

with
[.items[] ] [] | [.id, .name]  | .[0]

Demo:   https://jqplay.org/s/YPG4I9BMDn

A:

Why take the trouble of taking a roundabout approach for such a simple filter?  All you need is below.  The -c/--compact-output flag will put the output in a single line
jq -c '[.items[].id]'

jqplay - demo1
To demystify your filter from the pasted link, [.items[] ] [] will put the contents of .items in an array and will get it back from it.  Then [.id, .name] will create multiple arrays with 0th element being the .id value and .[0] will get only the id values without them being put in an array.  The approach doesn't make sense to me. 

In addition to the OP, there was a post in the comments to get the first element from each of the arrays below
["1", "2", "3"]
["4", "5", "6"]
["7", "8", "9"]

which can be done as
jq -cn '[inputs] | map(first)'

jqplay - demo2

