I am looking how I can use node.js to decode json.
My Application is very simple. I will get a Request: PUT with json. I need to check the json body for some value if that is present send a succuess (200) response.
how can I do in node to valid json.
,
var code = 'something you need to check';
try {
var decoded = JSON.parse(code);
// valid json
} catch(e) {
// invalid json
}