Produce a JSON String for the given audit event

@return
431456
private String mapToJSONString(Map<String, Object> eventMap) {
        JSONObject jsonEvent = new JSONObject();
        String jsonString = null;
        map2JSON(jsonEvent, eventMap);
        try {
            if (!compact) {
                jsonString = jsonEvent.serialize(true).replaceAll("\\\\/", "/");
            } else {
                jsonString = jsonEvent.toString();
            }
        } catch (IOException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Unexpected error converting AuditEvent to JSON String", e);
            }
        }
        return jsonString;
    }
911106
public static GetAuditstatusResult get_auditstatus(String access_token,String auditid){
		String json = String.format("{\"auditid\":\"%s\"}",auditid);
		HttpUriRequest httpUriRequest = RequestBuilder.post()
				.setHeader(jsonHeader)
				.setUri(BASE_URI + "/wxa/get_auditstatus")
				.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
				.setEntity(new StringEntity(json,Charset.forName("utf-8")))
				.build();
		return LocalHttpClient.executeJsonResult(httpUriRequest,GetAuditstatusResult.class);
	}
1138795
public static auditmessages[] get(nitro_service service) throws Exception{
		auditmessages obj = new auditmessages();
		auditmessages[] response = (auditmessages[])obj.get_resources(service);
		return response;
	}
823127
private JSONObject patternToJson() {

        JSONObject pattern = new JSONObject();
        if (null != getPatternType()) {
            pattern.put(JsonKey.PATTERN_TYPE, new JSONString(getPatternType().toString()));
            switch (getPatternType()) {
                case DAILY:
                    if (isEveryWorkingDay()) {
                        pattern.put(JsonKey.PATTERN_EVERYWORKINGDAY, JSONBoolean.getInstance(true));
                    } else {
                        pattern.put(JsonKey.PATTERN_INTERVAL, new JSONString(String.valueOf(getInterval())));
                    }
                    break;
                case WEEKLY:
                    pattern.put(JsonKey.PATTERN_INTERVAL, new JSONString(String.valueOf(getInterval())));
                    pattern.put(JsonKey.PATTERN_WEEKDAYS, toJsonStringList(getWeekDays()));
                    break;
                case MONTHLY:
                    pattern.put(JsonKey.PATTERN_INTERVAL, new JSONString(String.valueOf(getInterval())));
                    if (null != getWeekDay()) {
                        pattern.put(JsonKey.PATTERN_WEEKS_OF_MONTH, toJsonStringList(getWeeksOfMonth()));
                        pattern.put(JsonKey.PATTERN_WEEKDAYS, toJsonStringList(getWeekDays()));
                    } else {
                        pattern.put(JsonKey.PATTERN_DAY_OF_MONTH, new JSONString(String.valueOf(getDayOfMonth())));
                    }
                    break;
                case YEARLY:
                    pattern.put(JsonKey.PATTERN_MONTH, new JSONString(String.valueOf(getMonth())));
                    if (null != getWeekDay()) {
                        pattern.put(JsonKey.PATTERN_WEEKS_OF_MONTH, toJsonStringList(getWeeksOfMonth()));
                        pattern.put(JsonKey.PATTERN_WEEKDAYS, toJsonStringList(getWeekDays()));
                    } else {
                        pattern.put(JsonKey.PATTERN_DAY_OF_MONTH, new JSONString(String.valueOf(getDayOfMonth())));
                    }
                    break;
                case INDIVIDUAL:
                    pattern.put(JsonKey.PATTERN_DATES, datesToJsonArray(getIndividualDates()));
                    break;
                case NONE:
                default:
                    break;
            }
        }
        return pattern;
    }
724125
public Map<String, Object> toJson() {
    Map<String, Object> json = new HashMap<>();
    json.put("browserTimeout", browserTimeout);
    json.put("debug", debug);
    json.put("jettyMaxThreads", jettyMaxThreads);
    json.put("log", log);
    json.put("host", host);
    json.put("port", port);
    json.put("role", role);
    json.put("timeout", timeout);

    serializeFields(json);

    return json.entrySet().stream()
        .filter(entry -> entry.getValue() != null)
        .collect(toImmutableSortedMap(natural(), Map.Entry::getKey, Map.Entry::getValue));
  }
664292
private String jsonStringOf(Policy policy) throws JsonGenerationException,
            IOException {
        generator.writeStartObject();

        writeJsonKeyValue(JsonDocumentFields.VERSION, policy.getVersion());

        if (isNotNull(policy.getId()))
            writeJsonKeyValue(JsonDocumentFields.POLICY_ID, policy.getId());

        writeJsonArrayStart(JsonDocumentFields.STATEMENT);

        for (Statement statement : policy.getStatements()) {
            generator.writeStartObject();

            if (isNotNull(statement.getId())) {
                writeJsonKeyValue(JsonDocumentFields.STATEMENT_ID, statement.getId());
            }
            writeJsonKeyValue(JsonDocumentFields.STATEMENT_EFFECT, statement
                    .getEffect().toString());

            List<Principal> principals = statement.getPrincipals();
            if (isNotNull(principals) && !principals.isEmpty())
                writePrincipals(principals);

            List<Action> actions = statement.getActions();
            if (isNotNull(actions) && !actions.isEmpty())
                writeActions(actions);

            List<Resource> resources = statement.getResources();
            if (isNotNull(resources) && !resources.isEmpty())
                writeResources(resources);

            List<Condition> conditions = statement.getConditions();
            if (isNotNull(conditions) && !conditions.isEmpty())
                writeConditions(conditions);

            generator.writeEndObject();
        }

        writeJsonArrayEnd();

        generator.writeEndObject();

        generator.flush();

        return writer.toString();

    }
614190
@SuppressWarnings("unused")
  public String toJson() {
    Gson gson = new GsonBuilder()
      .registerTypeAdapterFactory(GeocodingAdapterFactory.create())
      .create();
    return gson.toJson(this);
  }
1288194
@Override
    public String format(AuditEvent event) {
        String formatText = super.format(event);

        try {
            return util.encrypt(formatText);
        } catch (InvalidKeyException e) {
            throw new Audit4jRuntimeException("", e);
        } catch (IllegalBlockSizeException e) {
            throw new Audit4jRuntimeException("", e);
        } catch (BadPaddingException e) {
            throw new Audit4jRuntimeException("", e);
        } catch (UnsupportedEncodingException e) {
            throw new Audit4jRuntimeException("", e);
        } catch (InvalidAlgorithmParameterException e) {
            throw new Audit4jRuntimeException("", e);
        } catch (NoSuchAlgorithmException e) {
            throw new Audit4jRuntimeException("", e);
        } catch (NoSuchPaddingException e) {
            throw new Audit4jRuntimeException("", e);
        }
    }
609896
public String getStringFrom(JsonValue json) {
    if (json.isString()) {
      return json.asString();
    } else {
      return json.toString();
    }
  }
18276
def tojson(self) -> str:
        
        return json.dumps({
            'event_id': str(self.id),
            'event_type': self.type,
            'schema_name': self.schema_name,
            'table_name': self.table_name,
            'row_id': self.row_id
        })
454973
public JSONObject toJson() {
        JSONObject ret = new JSONObject();
        ret.put("url",url);
        if (user != null) {
            ret.put("user",user);
            ret.put("password",password);
        }
        return ret;
    }
919026
@Override
    public String toJson() {
        try {
            return objectMapper.writeValueAsString(status());
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    }
967649
def ToJson(self):
        
        json = super(AccountState, self).ToJson()
        addr = Crypto.ToAddress(self.ScriptHash)

        json['address'] = addr
        json['script_hash'] = str(self.ScriptHash)
        json['frozen'] = self.IsFrozen
        json['votes'] = [v.hex() for v in self.Votes]

        balances = []
        for key, value in self.Balances.items():
            balances.append({'asset': key.To0xString(), 'value': value.ToString()})

        json['balances'] = balances
        return json
100123
private static Audit doBasicAuditCheck(JSONArray jsonArray, JSONArray global, AuditType auditType) {
        Audit audit = new Audit();
        audit.setType(auditType);
        if (!isConfigured(auditType, global)) {
            audit.setDataStatus(DataStatus.NOT_CONFIGURED);
            audit.setAuditStatus(AuditStatus.NA);
            return audit;
        }
        if (jsonArray == null || CollectionUtils.isEmpty(jsonArray)) {
            audit.setAuditStatus(AuditStatus.NA);
            audit.setDataStatus(DataStatus.NO_DATA);
            return audit;
        }
        if (isCollectorError(jsonArray)) {
            audit.setAuditStatus(AuditStatus.NA);
            audit.setDataStatus(DataStatus.ERROR);
            return audit;
        }
        return null;
    }
861741
public String createEventJson(HttpServletRequest request,
                                  HttpServletResponse response,
                                  String tenant,
                                  String userLogin,
                                  String userKey) {
        try {
            String requestBody = getRequestContent(request);
            String responseBody = getResponseContent(response);

            Instant startDate = Instant.ofEpochMilli(System.currentTimeMillis() - MdcUtils.getExecTimeMs());

            Map<String, Object> data = new LinkedHashMap<>();
            data.put("rid", MdcUtils.getRid());
            data.put("login", userLogin);
            data.put("userKey", userKey);
            data.put("tenant", tenant);
            data.put("msName", appName);
            data.put("operationName", getResourceName(request.getRequestURI())
                + " " + getOperation(request.getMethod()));
            data.put("operationUrl", request.getRequestURI());
            data.put("operationQueryString", request.getQueryString());
            data.put("startDate", startDate.toString());
            data.put("httpMethod", request.getMethod());
            data.put("requestBody", maskContent(requestBody, request.getRequestURI(), true, request.getMethod()));
            data.put("requestLength", requestBody.length());
            data.put("responseBody", maskContent(responseBody, request.getRequestURI(), false, request.getMethod()));
            data.put("responseLength", responseBody.length());
            data.put("requestHeaders", getRequestHeaders(request));
            data.put("responseHeaders", getResponseHeaders(response));
            data.put("httpStatusCode", response.getStatus());
            data.put("channelType", "HTTP");
            data.put("entityId", getEntityField(responseBody, "id"));
            data.put("entityKey", getEntityField(responseBody, "key"));
            data.put("entityTypeKey", getEntityField(responseBody, "typeKey"));
            data.put("execTime", MdcUtils.getExecTimeMs());

            return mapper.writeValueAsString(data);
        } catch (Exception e) {
            log.warn("Error creating timeline event", e);
        }
        return null;
    }
233745
private String toJSONString() {
        JSONStringer js = new JSONStringer();
        try {
            js.object();
            for (Map.Entry<Integer, Integer> entry : m_tokensMap.get().entrySet()) {
                js.key(entry.getKey().toString()).value(entry.getValue());
            }
            js.endObject();
        } catch (JSONException e) {
            throw new RuntimeException("Failed to serialize Hashinator Configuration to JSON.", e);
        }
        return js.toString();
    }
1238458
@Override
	public AuditFileWriter write(String event) {

		String str2 = event + CoreConstants.NEW_LINE;
		out.put(str2.getBytes(Charset.forName("UTF-8")));
		return this;
	}