jsonexport icon indicating copy to clipboard operation
jsonexport copied to clipboard

verticalOutput with Arrays

Open xp4u1 opened this issue 5 years ago • 1 comments

The vertical output option isn't working.

jsonexport(
  // example data
  [
    {
      name: "Paul",
      xp: 26
    },
    {
      name: "Joshi",
      xp: 87
    },
    {
      name: "Jakob",
      xp: 120
    }
  ],
  { rowDelimiter: ";", verticalOutput: true },
  (error, csv) => {
    if (error) return console.error(error);
    console.log(csv);
  }
);

The output is with true and false:

name;xp
Paul;26
Joshi;87
Jakob;120

But should be:

name;Paul;Joshi;Jakob
xp;26;87;120

xp4u1 avatar Dec 04 '19 16:12 xp4u1

@xp4u1 currently the vertialOutput only works if you are sending an object to jsonexport.

verticalOutput - Boolean Set this option to false to create a horizontal output for JSON Objects, headers in the first row, values in the second.

I will keep this issue as an enhancement to add support for vertialOutput for Arrays

kaue avatar May 23 '20 13:05 kaue