1

my issue is that I need to see all the items. When I run my script I get an array of objects in my log, but it doesn't show them all ... 40541 more items is not expected, i'm trying to log all the items

[
    {},
    {},
    ... 40541 more items
]

My package.json is logging all data to reportData.log after I run npm run start in my console. here is the scripts portion of my package.json

"scripts": {
    "start": "node --experimental-json-modules reportScript.js > reportData.log"
  },

here is the code in my reportScript.js, pseudo variables have been added

function getReport() {
    axios({
        method: 'get',
        url: reportEndpoint, //not actual, just pseudo
        headers: {
            'Content-Type':'application/json', 
            'Cookie':`sess.jwt=${sessJwt}`, //not actual, just pseudo
            'integration-key': `${integrationKey}`//not actual, just pseudo
        }
    })
    .then(response => {
        var reportResponse = response.data;
        console.log(reportResponse);
    })
}
  • Similar question here: https://stackoverflow.com/questions/41669039/dumping-whole-array-console-log-and-console-dir-output-num-more-items. – Xeelley Jan 14 '22 at 07:59

1 Answers1

0

I think you should add {responseType: 'json'} in axios args object like this

axios({
        method: 'get',
        url: reportEndpoint, 
        responseType: 'json',
        headers: {
            'Content-Type':'application/json', 
            'Cookie':`sess.jwt=${sessJwt}`, 
            'integration-key': `${integrationKey}`
        }
    })

If still you will not get objects content bcoz in console we can't see all data if you are using small data then it sometimes visible to you.

Or else you can render your data on browser and it will be more preferable just use json extension in browser.

Mishra Vaibhav
  • 216
  • 3
  • 11