here is my json:
[
{
"customer": "BigCo",
"performances": [
{
"playID": "hamlet",
"audience": 55
},
{
"playID": "as-like",
"audience": 35
},
{
"playID": "othello",
"audience": 40
}
]
}
]
here is my code(environment is node.js):
let readFile = require('fs').readFileSync
let invoices = JSON.parse(readFile('./invoices.json', 'utf8'))
console.log(invoices);
here is my result:
[
{ customer: 'BigCo', performances: [ [Object], [Object], [Object] ] }
]
I have read some questions related, and get some solutions like invoices = invoices[0]
or JSON.parse(JSON.stringify())
.
The thing I really hope to know is the reason.
Why do I get the result [ [Object], [Object], [Object] ]
and Which part cause the problem?