Set the POST/PUT body content in JSON format for this request.
776687
def json(self, data):
        """"""
        if data is not None:
            self._body = json.dumps(data)
            self.add_header('Content-Type', 'application/json')
1216363
def make_request_body(opts, headers)
      case
      when opts.body
        opts.body
      when opts.form
        form = HTTP::FormData.create opts.form
        headers[Headers::CONTENT_TYPE] ||= form.content_type
        form
      when opts.json
        body = MimeType[:json].encode opts.json
        headers[Headers::CONTENT_TYPE] ||= "application/json; charset=#{body.encoding.name}"
        body
      end
    end
596
def post(self):
        """"""
        self.set_header("Content-Type", "application/json")
        key = uuid.uuid4().hex
        metadata = json.loads(self.request.body.decode())
        metadata["uuid"] = key
        self.database[key] = metadata
        result = json.dumps({"uuid": key})
        self.write(result)
1344601
function putRouteFromDB(req, res) {
  expectJSON(function () {
    return db.put(req.uri, JSON.stringify(req.body)).then(() => req.body);
  }, res);
}
542695
function sendText (req, res, next, data) {
  setContentType(req, res,
    ["text", "html", "text/*", "application/*"],                // allow these types
    ["json", "*/json", "+json", "application/octet-stream"]);   // don't allow these types

  util.debug("Serializing the response as a string");
  res.send(_(data).toString());
}
145426
def _put(self, url, data={}):
        """"""
        req = self._session.put(self._api_prefix + url, data=data)
        return self._action(req)
512765
def publish_json(self, channel, obj):
        """"""
        return self.publish(channel, json.dumps(obj))
854808
public static HttpResponse putJson(String urlStr, String body) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("Content-Type", "application/json");
        return put(urlStr, body, headers);
    }
335964
def post(self):
        
        # type(data) = dict
        data = json.loads(self.request.body.decode())
        # type(method) = str
        method = data["method"]
        # type(params) = dict
        params = data["params"]
        if method == "sendmail":
            response = dispatch([sendmail],{'jsonrpc': '2.0', 'method': 'sendmail', 'params': [params], 'id': 1})
            #self.write(response)
        else:
            pass
692655
def post(self, content, endpoint=''):
        '''
        
        '''
        url = self.url(endpoint)
        post_content = json.dumps(content).encode('utf-8')
        headers = {'Content-Type': 'application/json'}
        request = Request(url, post_content, headers)

        response = urlopen(request)

        return json.loads(response.read().decode('utf-8'))
1017607
def convert_body(url, body):
        
        new_url = "%s.Post" % url
        params = json.loads(body)
        for key in params:
            new_url = "%s&%s=%s" % (new_url, key,
                                    re.sub(' ', '%20',
                                           str(params[key])))
        return new_url
1253449
async def receive_json(self, content: typing.Dict, **kwargs):
        
        # TODO assert format, if does not match return message.
        request_id = content.pop('request_id')
        action = content.pop('action')
        await self.handle_action(action, request_id=request_id, **content)
507971
def body(self):
        """"""

        if self._decoded_body == None:
            # Try to decode the JSON body. But raise an error if the
            # content-type is unexpected, or the JSON is invalid.

            raw_content_type = self.request.headers.get("content-type") or ""
            content_type = raw_content_type.split(";")[0].strip().lower()

            if content_type == "application/json":
                try:
                    self._decoded_body = escape.json_decode(self.request.body)
                except:
                    raise oz.json_api.ApiError("Bad JSON body")
            else:
                raise oz.json_api.ApiError("JSON body expected")

        return self._decoded_body
1362313
def post(self):
		
		data = json.loads(self.request.body.decode())
		response = dispatch([log],{'jsonrpc': '2.0', 
					'method': 'log', 'params': data, 'id': 1})
753509
def _update_response_body(self, resource):
        
        rpr = self._get_response_representer(resource)
        # Set content type and body of the response.
        self.request.response.content_type = \
                                rpr.content_type.mime_type_string
        rpr_body = rpr.to_bytes(resource)
        self.request.response.body = rpr_body
199079
@PostMapping("/setting/upload/json")
    public void uploadSetting(HttpServletRequest req) {
        this.validationSessionComponent.sessionCheck(req);
        this.msgSettingService.updateValidationData((MultipartHttpServletRequest) req);
    }
660335
def rest_put(url, data, timeout, show_error=False):
    ''''''
    try:
        response = requests.put(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
                                data=data, timeout=timeout)
        return response
    except Exception as exception:
        if show_error:
            print_error(exception)
        return None