After using JSON.stringify, my stringified variable looks like this:
{"ops":[{"insert":"drfsdfgg sdfg sdg \ns\ndfg\ndf\nsg\nsdfg\n"}]}
However, when I perform an UPDATE, the data in the MySQL database appears as follows:
{"ops":[{"insert":"drfsdfgg sdfg sdg
s
dfg
df
sg
sdfg
"}]}
I want to keep all the "\n" characters preserved as they are in the INSERT operation! (yes, INSERT works)
This is the SQL query being used:
connection.query("UPDATE products SET description ='" + req.body.description + "' WHERE id = " + req.body.id, function (error, results, fields) {
if (!!error) {
console.log('error');
} else {
// console.log(results);
res.json();
};
});