json package:scotty

Set the body of the response to the JSON encoding of the given value. Also sets "Content-Type" header to "application/json; charset=utf-8" if it has not already been set.
Set the body of the response to the JSON encoding of the given value. Also sets "Content-Type" header to "application/json; charset=utf-8" if it has not already been set.
Parse the request body as a JSON object and return it. Raises an exception if parse is unsuccessful. NB: uses body internally
Parse the request body as a JSON object and return it. If the JSON object is malformed, this sets the status to 400 Bad Request, and throws an exception. If the JSON fails to parse, this sets the status to 422 Unprocessable Entity. These status codes are as per https://www.restapitutorial.com/httpstatuscodes.html. NB : Internally this uses body.