oclif/cli-ux

`table` incorrectly outputs arrays with `output : 'json'` option

Opened this issue · 0 comments

const data = [
   {
      a: 'a',
      b: [
         'b1',
         'b2'
      ]
   }
]

console.log(JSON.stringify(data, null, 2))

cli.table(
    data,
    ['a', 'b'],
    {output: 'json'}
);

Output:

[
  {
    "a": "a",
    "b": [
      "b1",
      "b2"
    ]
  }
]

[
  {
    "a": "a",
    "b": "[ 'b1', 'b2' ]" //<----  Array has been converted into a string.
  }
]

Relates to: #309