convert complex and nested json to table in excel using javascript

I am trying to convert a JSON in which some items can contains arrays as well. I get a very nicely structured table if I convert my JSON in json2table.com. I want similar table to be created in Excel using Javascript/nodejs. I tried some packages like ‘json2xls’, ‘xlsx’ etc. However I am not getting the desired output. Here’s my JSON.

JSON:

{
"name":"Gopi",
"id":"01",
"subjects":[{
"subject":"maths",
"marks":"84"
},
{
"subject":"science",
"marks":"85"
}],
"teachers":{
"name": "teacherA"
}
}

enter image description here

I am using below code. But I see [object Object],[object Object] under the column ‘subjects’

var json2xls = require('json2xls');
const fs = require('fs')
var json = {
  "name": "Gopi",
  "id": "01",
  "subjects": [{
    "subject": "maths",
    "marks": "84"
  },
  {
    "subject": "science",
    "marks": "85"
  }],
  "teachers": {
    "name": "teacherA"
  }
}
var xls = json2xls(json);
fs.writeFileSync('stackof.xlsx', xls, 'binary');