Trying to write to a external json file using fs and express

I’m trying to write an object to a JSON, when passing the data through to the server I keep receiving this error and I cannot seem to find a solution to fix it…

Here is my code

APP.post('/api', (req, res) => {
    
    const data = req.body;
    console.log(data);

    try {
        fs.writeFileSync(PATH, data);
    } catch(err) {
        console.log(err)
    }

    res.send("Updated");
});

The object looks like the following i.e. req.body

{
  name: '',
  currentStats: {
    stat: 0,

  },
  trackStats: { history: 0 }
}

The error in question

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object