I want to return a string in a HTTP response as JSON using express JS. I am trying this but I am getting error. What am I doing wrong?
msg = '{"foo": "bar"}';
msgJSON = JSON.parse(msg);
res.status(200).send(msgJSON);
I need to be a string because it is generated concatenating key-value pairs