javascript: JSON.Stringify not showing the whole object

Solution for javascript: JSON.Stringify not showing the whole object
is Given Below:

I have a axios request and the err object in catch looks like this

enter image description here

But when i try to check the err object using

console.log(JSON.stringify(err, null, 2));

I see only

{
  "message": "Request failed with status code 400",
  "name": "Error",
  "stack": "Error: Request failed with status code 400n    at createError (http://localhost:3000/material-dashboard-react/static/js/vendors~main.chunk.js:43013:15)n    at settle (http://localhost:3000/material-dashboard-react/static/js/vendors~main.chunk.js:43247:12)n    at XMLHttpRequest.handleLoad (http://localhost:3000/material-dashboard-react/static/js/vendors~main.chunk.js:42487:7)",
  "config": {
    "url": "dj-rest-auth/login/",
    "method": "post",
    "data": "{"email":"[email protected]","password":"admin"}",
    "headers": {
      "Accept": "application/json",
      "Content-Type": "application/json"
    },
    "baseURL": "http://localhost:8025",
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 0,
    "xsrfCookieName": "XSRF-TOKEN",
    "xsrfHeaderName": "X-XSRF-TOKEN",
    "maxContentLength": -1,
    "maxBodyLength": -1
  }
}

I dont see the reponse object inside the err object

How to make JSON.stringify show the whole object

Do not JSON.stringify() the error object. Instead just console.log(err)

the simplest way to see the whole object is to simply call

JSON.stringify()

with no other arguments than the object itself.

console.log(JSON.stringify(err));

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify