Thanks. It works.
Daniel.
From: James Dingwall <[email protected]>
To: [email protected]
Cc: Daniel Suen <[email protected]>
Sent: Wednesday, December 14, 2016 11:38 AM
Subject: Re: update function decoding JSON payload?
On 14/12/16 16:29, Daniel Suen wrote:
> I am wondering if it is possible to decode JSON payload posted/put to update
> functions?
> function(doc, req) {...
> req.body // this is a JSON string, but can it be decoded?}
I do something like this:
try {
var json_body = JSON.parse(req.body)
}
catch(e) {
return [null, /* response body for invalid json */];
}
Zynstra is a private limited company registered in England and Wales
(registered number 07864369). Our registered office and Headquarters are at The
Innovation Centre, Broad Quay, Bath, BA1 1UD. This email, its contents and any
attachments are confidential. If you have received this message in error please
delete it from your system and advise the sender immediately.