Gets the JSON body of the request
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
205686
protected function parseJsonBody()
    {
        $data = json_decode($this->getBody(), true);
        
        if (!isset($data) && json_last_error()) {
            trigger_error("Failed to parse json body: " . json_last_error_msg(), E_USER_WARNING);
        }
        
        return $data;
    }
239537
def _default_body(self):
        
        if not self.data:
            return ""
        if self.content_type == 'application/json':
            import json
            return json.dumps(self.data)
        elif self.content_type == 'application/x-www-form-urlencoded':
            import urllib
            return urllib.urlencode(self.data)
        else:
            raise NotImplementedError(
                "You must manually encode the request "
                "body for '{}'".format(self.content_type)
            )
879149
def json(self):
        '''  '''
        ctype = self.environ.get('CONTENT_TYPE', '').lower().split(';')[0]
        if ctype == 'application/json':
            b = self._get_body_string()
            if not b:
                return None
            return json_loads(b)
        return None
322504
public static JSONObject getJSONObject(HttpGet request) throws JSONException {
        return UpworkRestClient.getJSONObject(request, METHOD_GET, new HashMap<String, String>());
    }
650389
def get_request_body_chunk(self, content: bytes, closed: bool,
                               more_content: bool) -> Dict[str, Any]:
        '''
        
        '''
        return {
            'content': content,
            'closed': closed,
            'more_content': more_content
        }
770616
def parse_json_body(req):
    """"""
    content_type = req.headers.get("Content-Type")
    if content_type and core.is_json(content_type):
        try:
            return core.parse_json(req.body)
        except TypeError:
            pass
        except json.JSONDecodeError as e:
            if e.doc == "":
                return core.missing
            else:
                raise
    return {}
294822
def getBody(self):
        
        data = None
        try:
            data = json.loads(self.request.body)
        except:
            data = json.loads(urllib.unquote_plus(self.request.body))
        return data
213273
def json(self):
        """"""

        if not self.headers and len(self.content) > 3:
            encoding = get_encoding_from_headers(self.headers)
            if encoding is not None:
                return json.loads(self.content.decode(encoding))
        return json.loads(self.content)
180721
def get_json(environ):
    '''
    
    '''
    content_type = environ.get('CONTENT_TYPE', '')
    if content_type != 'application/json':
        raise HTTPError(406, 'JSON required')

    try:
        return salt.utils.json.loads(read_body(environ))
    except ValueError as exc:
        raise HTTPError(400, exc)
1216903
def json(self, var, default=NOTSET, force=True):
        """"""
        return self._get(var, default=default, cast=json.loads, force=force)
403142
def runGetRequest(self, obj):
        
        protocolElement = obj.toProtocolElement()
        jsonString = protocol.toJson(protocolElement)
        return jsonString
740648
def _get_json(self, url):
        ""
        content = self._get_content('jsonds/' + url)
        try:
            json_content = json.loads(content.decode())
        except AttributeError:
            json_content = json.loads(content)
        if json_content['Comment']:
            log.warning(json_content['Comment'])
        if json_content['Result'] != 'OK':
            raise ValueError('Error while retrieving the parameter list.')
        return json_content['Data']
855841
def get_body(self, environ=None):
        """"""
        body = dict(
            status=self.code,
            message=self.description,
        )

        errors = self.get_errors()
        if self.errors:
            body['errors'] = errors

        return json.dumps(body)
900194
public function getJsonBody() : array
    {
        $json = json_decode($this->getRawBody(), true);

        if ($json === null) {
            throw new RuntimeException('Body could not be decoded as JSON');
        }

        return $json;
    }
185061
def json(self):
        """"""
        if 'json' not in self.environ.get('CONTENT_TYPE', ''):
            raise BadRequest('Not a JSON request')
        try:
            return loads(self.data)
        except Exception:
            raise BadRequest('Unable to read JSON request')
775196
def _json_request(self, method, path, data):
        

        response = self._request(method, path, data=data)
        _raise_for_status(response)
        if len(response.data) > 0:
            return _json_from_response(response)
        return response.data