In a file called data.js, I have a big object array:
var arr = [ {prop1: value, prop2: value},...]
I\'d like to use this array into my Node.js
You can directly get JSON or JSON array from any file in NODEJS there is no need to export it from a JS script
[ {
prop1: value,
prop2: value
},
{
prop1: val,
prop2: val2
},
...
]
Store it to a JSON file suppose test.json
Now you can export it as given below its very simple.
let data = require('./test.json');