Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

table incorrectly outputs arrays with output : 'json' option #463

Open
srlowe opened this issue Dec 8, 2021 · 0 comments
Open

table incorrectly outputs arrays with output : 'json' option #463

srlowe opened this issue Dec 8, 2021 · 0 comments

Comments

@srlowe
Copy link

srlowe commented Dec 8, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant