Returns the response body as twitter4j.JSONObject.<br>
Disconnects the internal HttpURLConnection silently.

@return response body as twitter4j.JSONObject
@throws TwitterException when the response body is not in JSON Object format
776099
public JSONObject asJSONObject() throws TwitterException {
        if (json == null) {
            try {
                json = new JSONObject(asString());
                if (CONF.isPrettyDebugEnabled()) {
                    logger.debug(json.toString(1));
                } else {
                    logger.debug(responseAsString != null ? responseAsString :
                        json.toString());
                }
            } catch (JSONException jsone) {
                if (responseAsString == null) {
                    throw new TwitterException(jsone.getMessage(), jsone);
                } else {
                    throw new TwitterException(jsone.getMessage() + ":" + this.responseAsString, jsone);
                }
            } finally {
                disconnectForcibly();
            }
        }
        return json;
    }
1033219
public JSONObject toJSON() {
        JSONObject ret = super.toJSON();
        if (arguments != null && arguments.size() > 0) {
            ret.put("arguments", arguments);
        }
        ret.put("operation", operation);
        return ret;
    }
639800
private Response readResponse() throws IOException {
		Response response = new Response();
		response.setResponseCode(connection.getResponseCode());
		response.setResponseMessage(connection.getResponseMessage());
		response.setHeaders(connection.getHeaderFields());
		try {
			response.setBody(getStringFromStream(connection.getInputStream()));
		} catch (IOException e) {
			response.setBody(getStringFromStream(connection.getErrorStream()));
		}
		return response;
	}
180947
public InputStream getResponseBodyAsStream() throws HttpException {
    try {
      HttpEntity ent = getResponseEntity();

      if (ent == null) {
        return null;
      }

      return ent.getContent();
    } catch (Throwable t) {
      throw new HttpException(t.getLocalizedMessage(), t);
    }
  }
548419
public JSONObject toJSON() throws JSONException {
        JSONObject json = new JSONObject();

        json.put(JSON_TYPE, this.getType());

        return json;
    }
513143
@NonNull
    public JSONObject toJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put(KEY_COMPONENT_NAME, (mComponentName != null) ? mComponentName.flattenToShortString() : null);
        jsonObject.put(KEY_IMAGE_URI, (mImageUri != null) ? mImageUri.toString() : null);
        jsonObject.put(KEY_TITLE, mTitle);
        jsonObject.put(KEY_BYLINE, mByline);
        jsonObject.put(KEY_ATTRIBUTION, mAttribution);
        jsonObject.put(KEY_TOKEN, mToken);
        jsonObject.put(KEY_VIEW_INTENT, (mViewIntent != null)
                ? mViewIntent.toUri(Intent.URI_INTENT_SCHEME) : null);
        jsonObject.put(KEY_META_FONT, mMetaFont);
        jsonObject.put(KEY_DATE_ADDED, mDateAdded != null ? mDateAdded.getTime() : 0);
        return jsonObject;
    }
914392
@SuppressWarnings("all")
    public JSONObject toJSONObject() {
        try {
            return Reflection.toType(this, JSONObject.class);
        } catch (Throwable e) {
            throw new RuntimeException("The output cannot be converted to jsonObject!", e);
        }
    }
774367
protected function getResponseBody() {
        $body = json_decode((string) $this->response->getBody());

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new InvalidArgumentException('The response body does not contain valid JSON data.');
        } else if (!is_array($body) && !($body instanceof stdClass)) {
            throw new InvalidArgumentException('The response body does not contain a valid JSON array / object.');
        }

        return $body;
    }
551676
public JSONObject getRawDataAsJson() throws IOException
    {
        String input = getRawDataAsString();
        if ( input == null ) {
            return null;
        }
        
        return new JSONObject(input);
    }
780804
public function getRequestBody() {
    if (!$this->evaluated) {
      $this->evaluateWebPage();
    }

    if ($this->webPage instanceof JsonPage) {
      $serializer = $this->router->getJsonSerializer();
      return $serializer->serialize($this->rawRequestBody);
    } else {
      return $this->rawRequestBody;
    }
  }
1071047
public HttpResponseMessageImpl getResponse() {
        HttpResponseMessageImpl resp = (HttpResponseMessageImpl) this.respPool.get();
        if (null == resp) {
            resp = new HttpResponseMessageImpl();
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getResponse(): " + resp);
        }
        return resp;
    }
875335
private JsonObject toJsonObject() {
        JsonObjectBuilder factory = Json.createObjectBuilder();
        if (enrollmentID != null) {
            // revoke all enrollments of this user, serial and aki are ignored in this case
            factory.add("id", enrollmentID);
        } else {
            // revoke one particular enrollment
            factory.add("serial", serial);
            factory.add("aki", aki);
        }

        if (null != reason) {
            factory.add("reason", reason);
        }

        if (caName != null) {
            factory.add(HFCAClient.FABRIC_CA_REQPROP, caName);
        }

        if (genCRL != null) {
            factory.add("gencrl", genCRL);
        }
        return factory.build();
    }
915906
public JsonObject har() {
        try {
            // Request BMP to create a new HAR for this Proxy
            HttpGet request = new HttpGet(requestURIBuilder()
                    .setPath(proxyURIPath() + "/har")
                    .build());

            // Execute request
            CloseableHttpResponse response = HTTPclient.execute(request);

            // Parse response into JSON
            JsonObject har = httpResponseToJsonObject(response);
            // Close HTTP Response
            response.close();

            return har;
        } catch (Exception e) {
            throw new BMPCUnableToCreateHarException(e);
        }
    }
868864
public JSONObject getJson() throws JSONException {
        JSONObject json = create();
        if (value != null)
            json.put("value", value);
        if (label != null)
            json.put("label", label);
        if (type != null)
            json.put("type", type);
        if (display != null)
            json.put("display", display.toString());
        if (sequence != 0)
            json.put("sequence", sequence);
        if (indexKey != null)
            json.put("indexKey", indexKey);
        return json;
    }
1271951
@Override
	public Serializable getObject() throws JMSException
    {
        if (body == null)
            return null;
        
        try
        {
        	return SerializationTools.fromByteArray(body);
        }
        catch (Exception e)
        {
        	throw new FFMQException("Cannot deserialize object message body","MESSAGE_ERROR",e);
        }
    }
696877
public function json()
    {

        if (!$this->isContentType('application/json')) {
            throw new Exception('Response is not JSON');
        }

        if (empty($this->_jsonAsObject)) {
            $this->_jsonAsObject = Utils::json_parse($this->text(), false);
        }

        return $this->_jsonAsObject;

    }
85288
public JSONObject parseToJson(HTTPResponse response) throws JSONException {
        // Set raw response
        this.response = response;
        // May throw JSONException
        return new JSONObject(response.body);
    }