I'm getting this error
Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'history' -> object with constructor 'Object'
    |     property 'previousData' -> object with constructor 'Array'
    --- index 0 closes the circle
for these code lines. Need help in understanding the error as well as rectifying it.
const data = req.payload['profileData'];
data.history = {
        lastUpdated: [currenttimestamp],
        previousData: [data]
};
If I JSON.stringify(data) after this I get the above error. I'm also getting the error if I save this in database. If I console.log(data) directly, I get [object object] response. (I don't understand this response too. Why is it giving an array of objects, when the the payload itself is a JSON.)
req.payload['profileData'] is of this sort:
{
  "color": "#A020F0",
  "name": "Eggplant",
  "scientificName": "Solanum melongena"
}
Is there a way to directly assign the data to previousData without de-structuring?
